[symfony-users] Re: Make Symfony and C++ work together

2011-02-17 Thread Gabriel Petchesi
On Thursday, February 17, 2011 10:04:29 AM UTC+2, Sebastian wrote:

 Thank you for your reply Gabriel, is there any documentation on this? 


There was in a presentation by Dustin Whittle if I remember correctly. No 
official documentation, howto, as far as I can tell.
 

 Personally I think XML for this task is an unneccessary overhead, compared 
 to exposing the C++ model via a php extension.


If you can get it to work via extension it would be the fastest way to 
access the data. 
I'm not sure about extending php via C++ code, I know that you can do that 
fine with C code.
 
gabriel


Plus both sides can use the same accessors and functionality, what would be 
 one of my main goals.

 Sebastian


-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] assigning a value to form widget problem please help

2011-02-17 Thread Helloise Smit
i have a form widget in _form.php

echo $form['catcher_id']-renderLabel();  //the label
echo $form['catcher_id']-renderError();  //the validator

symfony created the base class:
?php
/**
 * LpmService form base class.
 *
abstract class BaseLpmServiceForm extends BaseFormPropel
{
  public function setup()
  {
$this-setWidgets(array(
  'id'   = new sfWidgetFormInputHidden(),
  'name' = new sfWidgetFormInputText(),
  'wap_home' = new sfWidgetFormInputText(),
  'call_center_number'   = new sfWidgetFormInputText(),
 [color=#FF4000] 'catcher_id'   = new
sfWidgetFormPropelChoice(array('model' = 'LpmCatcher', 'add_empty' =
false)),[/color]
  'price_description'= new sfWidgetFormInputText(),
  'logo' = new sfWidgetFormInputText(),
  'invalid_msisdn_text'  = new sfWidgetFormInputText(),
  'terms_and_conditions' = new sfWidgetFormInputText(),
  'service_code' = new sfWidgetFormInputText(),
));

$this-setValidators(array(
  'id'   = new sfValidatorChoice(array('choices'
= array($this-getObject()-getId()), 'empty_value' = $this-
getObject()-getId(), 'required' = false)),
  'name' = new
sfValidatorString(array('max_length' = 64, 'required' = false)),
  'wap_home' = new
sfValidatorString(array('max_length' = 256, 'required' = false)),
  'call_center_number'   = new
sfValidatorString(array('max_length' = 13, 'required' = false)),
  'catcher_id'   = new
sfValidatorPropelChoice(array('model' = 'LpmCatcher', 'column' =
'id')),
  'price_description'= new
sfValidatorString(array('max_length' = 128, 'required' = false)),
  'logo' = new
sfValidatorString(array('max_length' = 255, 'required' = false)),
  'invalid_msisdn_text'  = new
sfValidatorString(array('max_length' = 255, 'required' = false)),
  'terms_and_conditions' = new
sfValidatorString(array('max_length' = 750, 'required' = false)),
  'service_code' = new
sfValidatorString(array('max_length' = 3, 'required' = false)),
));
$this-widgetSchema-setNameFormat('lpm_service[%s]');
$this-errorSchema = new sfValidatorErrorSchema($this-
validatorSchema);
parent::setup();
  }
  public function getModelName()
  {
return 'LpmService';
  }
}

and i re-created the dropdown list manually so i can incorporate a
onchange event:
 select name=services onchange=refreshPage(this.form.services)
id=droplist
   ?php
  $catcher_names = LpmCatcherPeer::getByAllNames();
  foreach($catcher_names as $row)
  {
  ?
option value=?php echo $row-getName()./.$row-
getId(); ? ?php
  if($row-getName() == $catcher_name) echo
'selected=selected'??php echo $row-getName();?/option
?php
  }
  ?
/select
how can i assign a value to echo $form['catcher_id'] because now when
i select a value from the dropdown and click submit the validator says
that catcher_id is required(because i created dropdown manually), so
how can i set the value manually???

i have: $form['catcher_id']-getWidget()-setAttribute('value', '11');
BUT IT IS NOT working!! please help???
thank you

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: Netbeans with sudo root permission problem

2011-02-17 Thread ModaCalcio.com - e-reall ebay
Hi Gabriel and thanks for explanation

Problem putting files on 664 is that they won't be handled if they are
included. I am trying some galleries with Flex that uses XML for flashvars,
and they are not streamed correctly, so I had to place that with 775 too. My
worry is that some handle of file is not done sometimes, and I don't see the
error , wasting my time troubling why it won't work as well eheheheh

The soution with id is very interesting, but I have to study how to do it!

Thanks anyway for your explanation.

2011/2/17 Gabriel Petchesi pghora...@gmail.com

 What you said is correct, the same setup I use for my development
 environment as well.
 umask: 002
 development users belonging to www-data group.
 Directories created with 775 and files with 664.

 Another thing that you could do, have not tried it myself, have multiple
 users share the same user id that
 is the same as the one used by www-data user. Something similar is used by
 Dreamhost hosting all static
 files belong to my user and apache (via fastcgi) uses the same user:group
 to run the php code, it's clean and does
 not cause problems.

 A couple of more suggestions:
 1. Do not use the netbeans packaged with Ubuntu. AFAIK that is the java
 version (optimized for developing java code)
 and usually is old one so better install the php only version downloaded
 from the netbeans site. It's much lighter and should work better.
 2. Install the official jre if you haven't done so already, now belonging
 to Sun/Oracle.

 gabriel


 On Wednesday, February 16, 2011 5:31:04 PM UTC+2, ereallstaff wrote:

 Hi I have an annoying problem develoing application with netbeans

 I am on Ubuntu 10.10 and use netbeans 6.9 , installed from Ubuntu
 software center repository

 I know that applications Symonfy and php file should belong to
 www:data user and group, where www-data that is the default Apache
 user.

 But if all files belong to www-data using netbeans with normal user
 permissions, won't makes me modify them. Opening netbeans or any
 program with sudo or gksudo , could bring a lot of problem. Also
 Firefox opened in debug with sudo permission, makes it not function
 good anymore.

 A nice solution should be setting all files to NormalUser:www-data
 ( user and group I mean) . So you can modify them in local, and when
 they are uploaded by ftp to server, they go automatically with correct
 ownership.

 As a known problem of this, is sure that fopen php function, for
 example, won't open files, unless you set permission to group too
 ( 775 in total if I not go wrong  rwxrwxr-x on files)

 I want to ask you all if you face same problem, and how did you solved
 that.

 Thanks
 Giuseppe



-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] Re: Netbeans with sudo root permission problem

2011-02-17 Thread Gareth McCumskey
As I mentioned before, the best and most secure setup is to have your files
sitting in your home directory (where your user account has all the
permissions necessary to edit) and setup virtual hosts on Apache instead.

On Thu, Feb 17, 2011 at 10:45 AM, ModaCalcio.com - e-reall ebay 
ereallst...@gmail.com wrote:

 Hi Gabriel and thanks for explanation

 Problem putting files on 664 is that they won't be handled if they are
 included. I am trying some galleries with Flex that uses XML for flashvars,
 and they are not streamed correctly, so I had to place that with 775 too. My
 worry is that some handle of file is not done sometimes, and I don't see the
 error , wasting my time troubling why it won't work as well eheheheh

 The soution with id is very interesting, but I have to study how to do it!

 Thanks anyway for your explanation.

 2011/2/17 Gabriel Petchesi pghora...@gmail.com

 What you said is correct, the same setup I use for my development
 environment as well.
 umask: 002
 development users belonging to www-data group.
 Directories created with 775 and files with 664.

 Another thing that you could do, have not tried it myself, have multiple
 users share the same user id that
 is the same as the one used by www-data user. Something similar is used by
 Dreamhost hosting all static
 files belong to my user and apache (via fastcgi) uses the same user:group
 to run the php code, it's clean and does
 not cause problems.

 A couple of more suggestions:
 1. Do not use the netbeans packaged with Ubuntu. AFAIK that is the java
 version (optimized for developing java code)
 and usually is old one so better install the php only version downloaded
 from the netbeans site. It's much lighter and should work better.
 2. Install the official jre if you haven't done so already, now belonging
 to Sun/Oracle.

 gabriel


 On Wednesday, February 16, 2011 5:31:04 PM UTC+2, ereallstaff wrote:

 Hi I have an annoying problem develoing application with netbeans

 I am on Ubuntu 10.10 and use netbeans 6.9 , installed from Ubuntu
 software center repository

 I know that applications Symonfy and php file should belong to
 www:data user and group, where www-data that is the default Apache
 user.

 But if all files belong to www-data using netbeans with normal user
 permissions, won't makes me modify them. Opening netbeans or any
 program with sudo or gksudo , could bring a lot of problem. Also
 Firefox opened in debug with sudo permission, makes it not function
 good anymore.

 A nice solution should be setting all files to NormalUser:www-data
 ( user and group I mean) . So you can modify them in local, and when
 they are uploaded by ftp to server, they go automatically with correct
 ownership.

 As a known problem of this, is sure that fopen php function, for
 example, won't open files, unless you set permission to group too
 ( 775 in total if I not go wrong  rwxrwxr-x on files)

 I want to ask you all if you face same problem, and how did you solved
 that.

 Thanks
 Giuseppe


  --
 If you want to report a vulnerability issue on symfony, please send it to
 security at symfony-project.com

 You received this message because you are subscribed to the Google
 Groups symfony users group.
 To post to this group, send email to symfony-users@googlegroups.com
 To unsubscribe from this group, send email to
 symfony-users+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en




-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc
identi.ca: @garethmcc

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] How do you log errors in the model the correct way?

2011-02-17 Thread davidsonrob
Hi,

As the complexity of my models has grown I have felt the need to log
errors in the model to help me thoubleshoot

The way I have been doing it is something like

sfContext::getInstance()-getLogger()err('{artistImage}
getImageThumbPath unexpected thumbnailType input param');


Which all works fine, it gives me a nice little error in my
debugtoolbar.

However when I use the CLI for tasks such as
php symfony doctrine:build --all

rebuilding models etc I get an sfContext error.

... So what would be the corrrect way for me to log errors in my model?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Symfony 2 or Symfony 1.4?

2011-02-17 Thread Daniel
I am not sure if this question has been asked before. I looked and
didn't see anything.

I'm starting a project and I'm thinking I should do it on Symfony 2
since the release is scheduled for March. What do you guys think? Any
advice?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] symfony2 - access everything from Entity class

2011-02-17 Thread Lideln
Hi !

I am experimenting the PR6, but I could not find how to access things
from Entity just as you would do from Controller ($this-
get('database_connection') or $this-
get('doctrine.orm.entity_manager') and so on).

It would be nice to place all static database queries inside the
Entities.

And also, I am willing to use my Member Entity as the Domain Object
for the register page.

Thank you all !

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: Forms and validation

2011-02-17 Thread Lideln
Hi !

I fixed the issue by removing my lame ctor and passing the name
parameter to the create() factory instead as advised.

Thank you all !


On 16 fév, 10:51, Bernhard Schussek bschus...@gmail.com wrote:
 Oops, parentheses I mean.

 /** @validation:NotNull */
 and
 /** @validation:NotNull() */

 both are valid.

 Bernhard

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Make Symfony and C++ work together

2011-02-17 Thread Sebastian
Hey folks,

I have the following scenario: A web application implemented with symfony 
but other parts in the background that would need to use the same objects 
(model) implemented in C++.
Example: A worker process that does jobs created by PHP async in C++. It 
would need to use the same model with the same functionality.
I want to prevent duplication. Has anyone experience with using the same 
model in PHP and C++?

My initial thought would be to implement the model in C++ and providing it 
as a PHP extension. However I am not sure yet how to make symfony work on 
top of that.
The webapplication is very classic and time critical so writing the web app 
completely in C++ is not an option,
also I have no profound knowledge of a C++ webframework.

Please share your thoughts on this...

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: Make Symfony and C++ work together

2011-02-17 Thread Sebastian
Thank you for your reply Gabriel, is there any documentation on this? 
Personally I think XML for this task is an unneccessary overhead, compared 
to exposing the C++ model via a php extension.
Plus both sides can use the same accessors and functionality, what would be 
one of my main goals.

Sebastian

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: sf1.4.9 : schema.yml relations article and sfGuardUser

2011-02-17 Thread benM
Yes, of course, should be integer...
Thank you, it works.

On 16 fév, 19:02, Roman Gnatyuk fo...@hackers.net.ua wrote:
      user_id: string(255)

 should be user_id: integer   relations:
      sfGuardUser:
        foreignType: one

 try:

    relations:
      sfGuardUser:
        foreignType: one
        local: user_id
        foreign: id

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] assigning a value to form widget problem please help

2011-02-17 Thread Erkhembayar Gantulga
hi Helloise Smit .

in you LpmServiceForm:

as Doctrine orm:
$this-widgetSchema['catcher_id'] = new sfWidgetFormDoctrineChoice(array(

   'label' = 'Catcher',

   'multiple' = false,

   'model' = 'LpmCatcher'),

 array());

as Propel:
$catcher_names = LpmCatcherPeer::getByAllNames();
## $catcher_names  must be array
$this-widgetSchema['catcher_id'] = new sfWidgetFormChoice(array('choices'
=$catcher_names ),

 array());

$this-validatorSchema['catcher_i'] = new sfValidatorChoice(array('choices'
= array_keys($catcher_names)),
   array(
'invalid' =
'invalid',
'required'
= true
  ));


Keep going


Erkhembayar Gantulga

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] Symfony 2 or Symfony 1.4?

2011-02-17 Thread Gareth McCumskey
This has been asked before but basically what it boils down to is:

- Do you have an application that will be complete and ready to go live only
after March?
- Will you be willing to make alterations (perhaps extensive alterations
even) after Symfony 2 is released in March to your application?
- Do you mind even after the March release there being bugs that need to be
worked out framework; i.e. stability might be an issue right after release.

If you answered yes to all those questions then feel free to use Symfony 2.
If however having a stable, thoroughly tested and implemented framework that
works well and reliably with little downtime for corrections is more
important, use 1.4.

On Thu, Feb 17, 2011 at 9:11 AM, Daniel daniel.ra...@msn.com wrote:

 I am not sure if this question has been asked before. I looked and
 didn't see anything.

 I'm starting a project and I'm thinking I should do it on Symfony 2
 since the release is scheduled for March. What do you guys think? Any
 advice?

 --
 If you want to report a vulnerability issue on symfony, please send it to
 security at symfony-project.com

 You received this message because you are subscribed to the Google
 Groups symfony users group.
 To post to this group, send email to symfony-users@googlegroups.com
 To unsubscribe from this group, send email to
 symfony-users+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en




-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc
identi.ca: @garethmcc

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] Multiple databases and data exchange

2011-02-17 Thread Gareth McCumskey
Your best bet for ensuring you have good database backups is to look at
setting up replication with master/slave setup. This is done through mysql
directly and not with the application.

The only way to do it through the application is to overwrite the save()
method within your propel model classes (the non Peer classes) and tell it
to save in your alternate database as well. But this will add extraordinary
load onto your app, essentially doubling every write transaction.

On Thu, Feb 17, 2011 at 9:41 AM, Thor thorste...@gmail.com wrote:

 Hi all, i have a question about multiple databases:

 supposing that i have the database.yml and everything setup to use two
 databases instead of one, with one that serve as a backup , and the
 other as the production...

 how can i achieve that with propel?

 i found a simple way to implement the 2 databases , here (

 http://www.lampjunkie.com/2008/04/using-multiple-databases-in-symfony-with-propel/
 ), what i need to know is:

 1) is there a way to get records from the backup server ,and with
 those , replace the production data ? ( i could work on entire tables
 too ,don't know what is simpler )
 2) how can i eventually save data in both databases at the same time?


 Thank you in advance

 --
 If you want to report a vulnerability issue on symfony, please send it to
 security at symfony-project.com

 You received this message because you are subscribed to the Google
 Groups symfony users group.
 To post to this group, send email to symfony-users@googlegroups.com
 To unsubscribe from this group, send email to
 symfony-users+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en




-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc
identi.ca: @garethmcc

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Serialise sfWidgetFormChoice

2011-02-17 Thread wickass
I am using symfony 1.4 in a project and i need to store multiple
options in a single field .

I am using sfWidgetFormChoice Set up loooks like this:

$status = Doctrine::getTable('Profile')-getStatuses();
$this-widgetSchema['status'] = new sfWidgetFormChoice(array(
'expanded'=true,
'choices'=$status,
'multiple'=true
));
$this-validatorSchema['status'] = new
sfValidatorChoice(array('choices'=array_keys($status),
'multiple'=true, 'required'=false));

In my model I use the following to serialise multiple options into
single field.

 public function  setStatus($data) {
$data = serialize($data);

$this-_set('status', $data);

}

Which works like a charm and save data as:

a:2:{i:0;s:7:relaxed;i:1;s:8:Inactive;}

However I'm am having difficulty retrieving the serialised string as
an array using the following in my model:

public function  getStatus() {
return unserialize($this-status);
}

Am I missing something here? I get the following error:

Notice: Undefined property: Profile::$status in C:\.../.././
Which doesnt make sense to me..

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: Netbeans with sudo root permission problem

2011-02-17 Thread wickass
I Had a similar issue long ago When I was working on ubuntu.
From what I remeber I added my user to the www:data group whic solved
most of my problems.


On Feb 16, 5:31 pm, ereallstaff ereallst...@gmail.com wrote:
 Hi I have an annoying problem develoing application with netbeans

 I am on Ubuntu 10.10 and use netbeans 6.9 , installed from Ubuntu
 software center repository

 I know that applications Symonfy and php file should belong to
 www:data user and group, where www-data that is the default Apache
 user.

 But if all files belong to www-data using netbeans with normal user
 permissions, won't makes me modify them. Opening netbeans or any
 program with sudo or gksudo , could bring a lot of problem. Also
 Firefox opened in debug with sudo permission, makes it not function
 good anymore.

 A nice solution should be setting all files to NormalUser:www-data
 ( user and group I mean) . So you can modify them in local, and when
 they are uploaded by ftp to server, they go automatically with correct
 ownership.

 As a known problem of this, is sure that fopen php function, for
 example, won't open files, unless you set permission to group too
 ( 775 in total if I not go wrong  rwxrwxr-x on files)

 I want to ask you all if you face same problem, and how did you solved
 that.

 Thanks
 Giuseppe

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] symfony2 - access everything from Entity class

2011-02-17 Thread Christophe COEVOET

Le 16/02/2011 23:00, Lideln a écrit :

Hi !

I am experimenting the PR6, but I could not find how to access things
from Entity just as you would do from Controller ($this-

get('database_connection') or $this-
get('doctrine.orm.entity_manager') and so on).

It would be nice to place all static database queries inside the
Entities.
The right place for the queries is the EntityRepository, not the entity 
itself. Look at the Doctrine2 doc about custom repositories: 
http://www.doctrine-project.org/docs/orm/2.0/en/reference/working-with-objects.html#custom-repositories

And also, I am willing to use my Member Entity as the Domain Object
for the register page.
Same here. Use your custom repository by implementing 
Symfony\Component\Security\Core\User\UserProviderInterface and use the 
Doctrine entity Provider as described here: 
http://docs.symfony-reloaded.org/master/guides/security/users.html#doctrine-entity-provider


Regards

--
Christophe | Stof

--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: Social network with symfony ?

2011-02-17 Thread Massimiliano Arione
On Wednesday, February 16, 2011 5:59:13 PM UTC+1, coolmec33 wrote:

 I want to know the feasibility of a social network (profiles, walls, 
 groups, friends ) with the symfony framework. 



http://www.symfony-project.org/plugins/sfSocialPlugin 

cheers
Massimiliano Arione

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] Symfony 2 or Symfony 1.4?

2011-02-17 Thread Tac Tacelosky
I struggled with the same question for the last few weeks, and finally
decided to stick with CodeIgniter for prototyping until Symfony2 is closer
to release.  The software itself is amazing, but the documentation is all
over the place.  Very few of the tutorials work with the latest snapshot,
because the directory structure has moved around, it appears the key console
commands like app:init have been removed, generating an entity class from
doctrine via a yml file is probably possible, but the documentation says
something like put the file in your configuration directory, which might
be /metadata, or maybe /metadata/orm, but there will be no errors telling
you where it's looking for it if it can't find it.

And if you look online for version 2 help, everything is labeled as
2.0.0-DEV, no indication of PR2 or PR6, whatever, so there's no way to tell
if the tutorial is using a recent version.

I should point out that I'm new to symfony and to doctrine and to ORM, I'm
anxious to move away from SQL statements all over my code, and think that
the symfony2/doctrine2 combination is going to rock.  But even the twig view
library is only a month into release, I integrated it with CI figuring that
I could then at least port the twig files over when I move to sf2, but even
there it suffers from a paucity of documentation and examples.  (I'm using
Smarty3 with CI now, so it won't be hard to move when the time comes, and
maybe sooner if I can figure out the twig issue I got stuck on).

If you're in the Washington, DC area, I'm looking for form a Symfony2 users
group to ease the learning curve.  When RC1 comes out and the API is stable,
and symfony2bundles starts hosting projects that work with it, and tutorials
are available, it's gonna be great, so build around expecting to move fairly
soon.

Tac

On Thu, Feb 17, 2011 at 2:11 AM, Daniel daniel.ra...@msn.com wrote:

 I am not sure if this question has been asked before. I looked and
 didn't see anything.

 I'm starting a project and I'm thinking I should do it on Symfony 2
 since the release is scheduled for March. What do you guys think? Any
 advice?

 --
 If you want to report a vulnerability issue on symfony, please send it to
 security at symfony-project.com

 You received this message because you are subscribed to the Google
 Groups symfony users group.
 To post to this group, send email to symfony-users@googlegroups.com
 To unsubscribe from this group, send email to
 symfony-users+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en


-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] assigning a value to form widget problem please help

2011-02-17 Thread Altansuh A
Symfony Oracle connection hiij vzsen v. Holboj vzsen chin Use of undefined
constant OCI_COMMIT_ON_SUCCESS - assumed 'OCI_COMMIT_ON_SUCCESS aldaa
garaad bh yum

On Thu, Feb 17, 2011 at 5:39 PM, Erkhembayar Gantulga
erheme...@gmail.comwrote:

 hi  Helloise Smit .

 in you LpmServiceForm:

 as Doctrine orm:
 $this-widgetSchema['catcher_id'] = new sfWidgetFormDoctrineChoice(array(

  'label' = 'Catcher',

  'multiple' = false,

  'model' = 'LpmCatcher'),

  array());

 as Propel:
 $catcher_names = LpmCatcherPeer::getByAllNames();
 ## $catcher_names  must be array
 $this-widgetSchema['catcher_id'] = new sfWidgetFormChoice(array('choices'
 =$catcher_names ),

  array());

 $this-validatorSchema['catcher_i'] = new
 sfValidatorChoice(array('choices' = array_keys($catcher_names)),
array(
 'invalid'
 = 'invalid',
 'required'
 = true
   ));


 Keep going


 Erkhembayar Gantulga

 --
 If you want to report a vulnerability issue on symfony, please send it to
 security at symfony-project.com

 You received this message because you are subscribed to the Google
 Groups symfony users group.
 To post to this group, send email to symfony-users@googlegroups.com
 To unsubscribe from this group, send email to
 symfony-users+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en


-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: Make Symfony and C++ work together

2011-02-17 Thread Sebastian
You can wrap C++ classes in PHP extensions.
When I get to that point I will share my findings about how it works with 
Symfony :)

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: How do you log errors in the model the correct way?

2011-02-17 Thread Damon Jones
Using sfContext has its problems, as you have seen. It couples your
models and where you can create your own context in your own tasks,
that doesn't solve the problem with standard tasks.

How about using the event dispatcher?

In your model:

class Something
{
  protected $dispatcher;

  public function __construct(sfDispatcher $dispatcher = null)
  {
if ($dispatcher) {
  $this-dispatcher = $dispatcher;
} else {
  $this-dispatcher = ProjectConfiguration::getActive()-
getEventDispatcher();
}
  }

  public function log($message, $priority = sfLogger::ERR)
  {
$this-dispatcher-notify(new sfEvent($this, 'application.log',
array('message' = $message, 'priority' = $priority)));
  }
}

You'll need to set the logger for the prod environment to
sfAggregateLogger instead of sfNoLogger and set your level, etc.

Hope this helps.

On Feb 17, 4:09 am, davidsonrob rob.davidso...@gmail.com wrote:
 Hi,

 As the complexity of my models has grown I have felt the need to log
 errors in the model to help me thoubleshoot

 The way I have been doing it is something like

 sfContext::getInstance()-getLogger()err('{artistImage}
 getImageThumbPath unexpected thumbnailType input param');

 Which all works fine, it gives me a nice little error in my
 debugtoolbar.

 However when I use the CLI for tasks such as
 php symfony doctrine:build --all

 rebuilding models etc I get an sfContext error.

 ... So what would be the corrrect way for me to log errors in my model?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Doctrine findOneBy and leftJoin

2011-02-17 Thread benM
Hi all,

I have a class named CorpUserRememberKeyTable by Doctrine which
content is like :

public static function getInstance()
{
return Doctrine_Core::getTable('CorpUserRememberKey');
}

public function myFindOneByRememberKey($remember_key)
{
  $q = $this-createQuery('rk')
-leftJoin('rk.CorpUser u')
-andWhere('rk.rememeber_key = ?', $remember_key)
-andWhere('u.is_activated = ?', true);
  return $q-fetchOne();
}


in apps/frontend/lib/myUser.class.php

$user = Doctrine_Core::getTable('CorpUserRememberKey')-
myFindOneByRememberKey($remember_key);

   foreach($user as $key = $value)
{
echo ' $user-'.$key.' : '.$value.'br /';
}

The $user object is not hydrated with CorpUser values but just with
CorpUserRememberKey.
I want to have an object with the values of de two tables. How to
proceed ?

Thx

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: Serialise sfWidgetFormChoice

2011-02-17 Thread wickass
I solved my problem

I had to use return unserialize( parent::_get('status') );

because base class uses magic method to return value and caused
infinite loop by method calling itself or something like that ;)

On Feb 17, 3:53 pm, wickass wick...@gmail.com wrote:
 I am using symfony 1.4 in a project and i need to store multiple
 options in a single field .

 I am using sfWidgetFormChoice Set up loooks like this:

 $status = Doctrine::getTable('Profile')-getStatuses();
         $this-widgetSchema['status'] = new sfWidgetFormChoice(array(
             'expanded'=true,
             'choices'=$status,
             'multiple'=true
             ));
         $this-validatorSchema['status'] = new
 sfValidatorChoice(array('choices'=array_keys($status),
 'multiple'=true, 'required'=false));

 In my model I use the following to serialise multiple options into
 single field.

  public function  setStatus($data) {
         $data = serialize($data);

         $this-_set('status', $data);

     }

 Which works like a charm and save data as:

 a:2:{i:0;s:7:relaxed;i:1;s:8:Inactive;}

 However I'm am having difficulty retrieving the serialised string as
 an array using the following in my model:

 public function  getStatus() {
         return unserialize($this-status);
     }

 Am I missing something here? I get the following error:

 Notice: Undefined property: Profile::$status in C:\.../.././
 Which doesnt make sense to me..

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] perl File::Tail php clone?

2011-02-17 Thread rafix
i need read and store in DB (mongoDB or MySQL) logs files, exists any
php lib like perl File::Tail module?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: Serialise sfWidgetFormChoice

2011-02-17 Thread Damon Jones
In getStatus() you refer to $this-status (which is calling the
getStatus() method, hence your infinite loop).

You don't need to use parent::_get('status), just $this-
_get('status') will work. Unlike Propel, Doctrine doesn't use
parent::getXXX() and parent::setXXX() to override, it uses _get() and
_set() which calls magic methods.

On Feb 17, 11:07 am, wickass wick...@gmail.com wrote:
 I solved my problem

 I had to use return unserialize( parent::_get('status') );

 because base class uses magic method to return value and caused
 infinite loop by method calling itself or something like that ;)

 On Feb 17, 3:53 pm, wickass wick...@gmail.com wrote:



  I am using symfony 1.4 in a project and i need to store multiple
  options in a single field .

  I am using sfWidgetFormChoice Set up loooks like this:

  $status = Doctrine::getTable('Profile')-getStatuses();
          $this-widgetSchema['status'] = new sfWidgetFormChoice(array(
              'expanded'=true,
              'choices'=$status,
              'multiple'=true
              ));
          $this-validatorSchema['status'] = new
  sfValidatorChoice(array('choices'=array_keys($status),
  'multiple'=true, 'required'=false));

  In my model I use the following to serialise multiple options into
  single field.

   public function  setStatus($data) {
          $data = serialize($data);

          $this-_set('status', $data);

      }

  Which works like a charm and save data as:

  a:2:{i:0;s:7:relaxed;i:1;s:8:Inactive;}

  However I'm am having difficulty retrieving the serialised string as
  an array using the following in my model:

  public function  getStatus() {
          return unserialize($this-status);
      }

  Am I missing something here? I get the following error:

  Notice: Undefined property: Profile::$status in C:\.../.././
  Which doesnt make sense to me..

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] Odd Doctrine behavior in form processing

2011-02-17 Thread Yitzchak Schaffer

On 2011-02-15 14:40, Yitzchak Schaffer wrote:

I am encountering unexpected behavior with form processing, symfony 1.4
with Doctrine. I have a table which has a many-to-many relationship to
itself:



This turned out to be a known issue:
http://stackoverflow.com/questions/5010146/odd-many-to-many-behavior-in-symfony-1-4-forms-with-doctrine/5031502

--
Yitzchak Schaffer

--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] chekbox creating or not a line into a link table

2011-02-17 Thread l3ia-etu
Hello everyone,

I have a link table:
CommandeOperationTechniqueSupplement:
 columns:
  cot_id: { type: integer , notnull: true}
  ots_id: { type: integer , notnull: true}
 relations:
  CommandeOperationTechnique: { local: cot_id, onDelete: CASCADE }
  OperationTechniqueSupplement: { local: ots_id }

and i would like to create a form with a checkbox, to create or not
the line beetwen  the 2 others tables:

so i thought that it was a good idea to use sfValidatorCallback:
when the validator action will be there, i could create or not the
line

$this-validatorSchema['lien'] = new sfValidatorCallback(array(
'callback' = array($this, 'MonValidator')
));

function MonValidator($validator, $value)
{
die( MonValidator=.$value);
   }

but i never go into MonValidator (the die would stop everything)

is there a better way, or why does this doesn't works ?

thanks

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: How do you log errors in the model the correct way?

2011-02-17 Thread Leon van der Ree
We had this same issue and we have solved this by implementing a
LogFactory.

I would not inject the dispatcher in my model,
For one, because you want to log, not dispatch
And for two, because it is very cumbersome to provide the logger to
all your classes (changing all constructors and constructor calls)
And finally for three, because a reference to the logger (dispatcher)
makes it impossible to serialize your classes, which makes it
impossible to cache them...

I would recommend a LogFactory that can return the logger by:
LogFactory::getLogger()  which returns an sfLogger instance.
This LogFactory needs to be initialized early when running your
webApps or tasks by parsing the factory.yml

I can provide you some examples and the logfactory implementation
tomorrow if you like.

Please note that I would not use this solution in Symfony2. In that
case I would use the DI containers to configure the injection of the
logger into the constructors of my classes.

regards
Leon

Damon Jones schreef:
 Using sfContext has its problems, as you have seen. It couples your
 models and where you can create your own context in your own tasks,
 that doesn't solve the problem with standard tasks.

 How about using the event dispatcher?

 In your model:

 class Something
 {
   protected $dispatcher;

   public function __construct(sfDispatcher $dispatcher = null)
   {
 if ($dispatcher) {
   $this-dispatcher = $dispatcher;
 } else {
   $this-dispatcher = ProjectConfiguration::getActive()-
 getEventDispatcher();
 }
   }

   public function log($message, $priority = sfLogger::ERR)
   {
 $this-dispatcher-notify(new sfEvent($this, 'application.log',
 array('message' = $message, 'priority' = $priority)));
   }
 }

 You'll need to set the logger for the prod environment to
 sfAggregateLogger instead of sfNoLogger and set your level, etc.

 Hope this helps.

 On Feb 17, 4:09 am, davidsonrob rob.davidso...@gmail.com wrote:
  Hi,
 
  As the complexity of my models has grown I have felt the need to log
  errors in the model to help me thoubleshoot
 
  The way I have been doing it is something like
 
  sfContext::getInstance()-getLogger()err('{artistImage}
  getImageThumbPath unexpected thumbnailType input param');
 
  Which all works fine, it gives me a nice little error in my
  debugtoolbar.
 
  However when I use the CLI for tasks such as
  php symfony doctrine:build --all
 
  rebuilding models etc I get an sfContext error.
 
  ... So what would be the corrrect way for me to log errors in my model?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Re: How to save form data into database ?

2011-02-17 Thread jdewit
You need to add your entity to the bind

$form-bind($this-get('request'), $news); 

// If the form has been submitted and is valid... 
if ($form-isValid()) { 
  $em = $this-getEm(); 
  $em-persist($news); 
  $em-flush(); 
  return $this-redirect($this-generateUrl('news')); 
} 

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] [Symfony2] - PHPUnit Form Error

2011-02-17 Thread jdewit
I'm getting the error:

PHP Fatal error:  Uncaught exception 'Exception' with message 'Serialization 
of 'Closure' is not allowed' 

Here's my code:

 ?php
namespace Sensio\HelloBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class AccountControllerTest extends WebTestCase
{
public function testIndex()
{
$client = $this-createClient();
$crawler = $client-request('GET', '/account/new');
$form = $crawler-selectButton('submit');
$form['field'] = 'Test';
$crawler = $client-submit($form);
}
}

Thanks!

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Throwing a 406 error

2011-02-17 Thread violyn
Hi,
I manually check to see if i can provide the accept content the client 
wants:
$header_array = 
$this-container-get('request')-getAcceptableContentTypes();
then i check if $header_array contains the content type i have.

what i want to do is throw a 406 exception if $header_array does not contain 
any of the content my controller can return.
how do i throw a 406 error?

also, does symfony have built in content negotiation that i could use to 
make sure i am giving back the preferred content type?

thanks, 

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en