[symfony-users] how can i load all my model classes in the proyect configuration class?
Hi everybody, I have troubles, i need to get loaded all the model classes on the ProjectConfiguration class. I hope someone knows how to do this. Thanks so much --~--~-~--~~~---~--~~ 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 can i load all my model classes in the proyect configuration class?
I use Symfony 1.2 and Doctrine 1.0 Sorry for this On 18 jun, 14:22, Gary Rojas gary.r...@gmail.com wrote: Hi everybody, I have troubles, i need to get loaded all the model classes on the ProjectConfiguration class. I hope someone knows how to do this. Thanks so much --~--~-~--~~~---~--~~ 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 schema file problems with generated forms
I'm working with Symfony 1.2 and Doctrine 1.0 and I'm getting errors with the generated forms Here is part of my schema.yml ## pltProjectModule: tableName: plt_project_module columns: project_id: type: integer(4) primary: true module_id: type: integer(4) primary: true relations: Project: class: pltProject foreignAlias: ProjectModules local: project_id onDelete: CASCADE Module: class: pltModule foreignAlias: ProjectModules local: module_id onDelete: CASCADE pltProjectModuleConfig: tableName: plt_project_module_config columns: project_id: type: integer(4) primary: true module_id: type: integer(4) primary: true config_id: type: integer(4) primary: true value: type: string(250) notnull: true default: '' relations: Config: class: pltConfig foreignAlias: ProjectModuleConfigs local: config_id onDelete: CASCADE ProjectModule: class: pltProjectModule foreignAlias: ProjectModuleConfigs local: [project_id, module_id] onDelete: CASCADE ## You can see i'm using a many-to-many relation and the primary key is composed by two fields (local: [project_id, module_id] defined in pltProjectModuleConfig model ). But when i go to see the form for the model BasepltProjectModuleConfigForm i find an error in the field value. Here is BasepltProjectModuleConfigForm.class.php ## public function setup() { $this-setWidgets(array( 'project_id' = new sfWidgetFormInputHidden(), 'module_id' = new sfWidgetFormInputHidden(), 'config_id' = new sfWidgetFormInputHidden(), 'value' = new Notice: Array to string conversion in E:\wamp\bin\php\php5.2.9-1\PEAR \symfony\plugins\sfDoctrinePlugin\lib\generator \sfDoctrineColumn.class.php on line 230 sfWidgetFormInput( Notice: Array to string conversion in E:\wamp\bin\php\php5.2.9-1\PEAR \symfony\plugins\sfDoctrinePlugin\lib\generator \sfDoctrineColumn.class.php on line 230 ), )); $this-setValidators(array( 'project_id' = new sfValidatorDoctrineChoice(array('model' = 'pltProjectModuleConfig', 'column' = 'project_id', 'required' = false)), 'module_id' = new sfValidatorDoctrineChoice(array('model' = 'pltProjectModuleConfig', 'column' = 'module_id', 'required' = false)), 'config_id' = new sfValidatorDoctrineChoice(array('model' = 'pltProjectModuleConfig', 'column' = 'config_id', 'required' = false)), 'value' = new Notice: Array to string conversion in E:\wamp\bin\php\php5.2.9-1\PEAR \symfony\plugins\sfDoctrinePlugin\lib\generator \sfDoctrineColumn.class.php on line 230 sfValidatorString( Notice: Array to string conversion in E:\wamp\bin\php\php5.2.9-1\PEAR \symfony\plugins\sfDoctrinePlugin\lib\generator \sfDoctrineColumn.class.php on line 230 array('max_length' = 250)), )); $this-widgetSchema-setNameFormat('plt_project_module_config [%s]'); $this-errorSchema = new sfValidatorErrorSchema($this- validatorSchema); parent::setup(); } ## I trying solve in many ways but I think the problem is local: [project_id, module_id] because when i take it out forms are generated fine. Thanks so much --~--~-~--~~~---~--~~ 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: Security doubts on sfDoctrineGuardPlugin
Thanks for your answer Ken, but the signin action uses sfGuardValidatorUser which pass the user object through it. Here is the 'doClean' method which call 'findOneByUsername' and not 'retrieveByUsername' and the user's status is never checked . //plugins/sfDoctrineGuardPlugin\lib/validator/ sfGuardValidatorUser.class.php class sfGuardValidatorUser extends sfValidatorBase ... protected function doClean($values) { $username = isset($values[$this-getOption('username_field')]) ? $values[$this-getOption('username_field')] : ''; $password = isset($values[$this-getOption('password_field')]) ? $values[$this-getOption('password_field')] : ''; // user exists? if ($user = Doctrine::getTable('sfGuardUser')-findOneByUsername ($username)) { // password is ok? if ($user-checkPassword($password)) { return array_merge($values, array('user' = $user)); } } if ($this-getOption('throw_global_error')) { throw new sfValidatorError($this, 'invalid'); } throw new sfValidatorErrorSchema($this, array($this-getOption ('username_field') = new sfValidatorError($this, 'invalid'))); } Thanks ! On 7 mayo, 01:01, Ken Marfilla marfillas...@gmail.com wrote: It does, if you will look closely at PluginsfGuardUserTable.php class PluginsfGuardUserTable extends Doctrine_Table { public static function retrieveByUsername($username, $isActive = true) { return Doctrine_Query::create() -from('sfGuardUser u') -where('u.username = ?', $username) -addWhere('u.is_active = ?', $isActive) -fetchOne(); } } On May 7, 4:09 am, Gary Rojas gary.r...@gmail.com wrote: I was reviewing howsfDoctrineGuardPlugincontrol the sign in and i found that this plugin doesn't make any validation about the status of the user (i think this should be with the is_active field). I realized about this because i have a user with is_active = 0 and this user can sign in without any problems. My doubt is if this behavior is normal and we have to ensure or maybe is asecurityproblem. Thanks for your answers. --~--~-~--~~~---~--~~ 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: Authentication with email
I'm a newby using Symfony 1.2 but I think you are implementing a validator based on symfony 1.0 if you are sure that this is correct try by editing the file: plugins/sfDoctrineGuardPlugin/lib/form/doctrine/base/BasesfGuardFormSignin.class.php change the following line: this-validatorSchema-setPostValidator(new sfGuardValidatorUser()); by: $this-validatorSchema-setPostValidator(new sfGuardUserByEmailValidator ()); Regards, Gary Rojas 2009/5/5 justin_davis jdavis1...@gmail.com: Hey all, I'm using Symfony 1.2 and Doctrine, with the sfDoctrineGuard plugin. I have a table for profile information called sfDoctrineGuardProfile. Creating a new user and profile works great. I want the user to be able to log in with their email address, instead of a username. I set the username field in the sfDoctrineGuard schema to allow null values. I found an email signin validation script here (http://bluehorn.co.nz/2009/04/29/implementing-email-login-with- sfguardplugin/) and modified it to work with doctrine. The email validation is as follows: class sfGuardUserByEmailValidator extends sfValidator { public function initialize($context, $parameters = null) { // initialize parent parent::initialize($context); // set defaults $this-getParameterHolder()-set(’username_error’, ‘Email or password is not valid.’); $this-getParameterHolder()-set(’password_field’, ‘password’); $this-getParameterHolder()-set(’remember_field’, ‘remember’); $this-getParameterHolder()-add($parameters); return true; } public function execute($value, $error) { $password_field = $this-getParameterHolder()-get(’password_field’); $password = $this-getContext()-getRequest()-getParameter ($password_field); $remember = false; $remember_field = $this-getParameterHolder()-get(’remember_field’); $remember = $this-getContext()-getRequest()-getParameter ($remember_field); $email = $value; $profile = sfGuardUserProfileTable::retrieveByEmail($email); if (!$profile) return false; $user = $profile-getsfGuardUser(); // user exists and active? if ($user and $user-getIsActive()) { // password is ok? if ($user-checkPassword($password)) { $this-getContext()-getUser()-signIn($user, $remember); return true; } } $error = $this-getParameterHolder()-get(’username_error’); return false; } } How do I make sfGuardAuth use this validator instead of the default one? I tried, per the blog post, creating a signin.yml file with the following values: methods: post: [username, password] names: username: required: true required_msg: Your username is required validators: [userValidator] password: required: true required_msg: Your password is required userValidator: class: sfGuardUserByEmailValidator param: password_field: password remember_field: remember Placed that in apps/frontend/modules/sfGuardAuth/validate/signin.yml and it doesn't seem to be working. I'm still getting username/ password errors, instead of email/password errors. Basically, how do I override the standard sfGuardAuth validator and substitute this one? Thanks so much! Justin --~--~-~--~~~---~--~~ 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] Security doubts on sfDoctrineGuardPlugin
I was reviewing how sfDoctrineGuardPlugin control the sign in and i found that this plugin doesn't make any validation about the status of the user (i think this should be with the is_active field). I realized about this because i have a user with is_active = 0 and this user can sign in without any problems. My doubt is if this behavior is normal and we have to ensure or maybe is a security problem. Thanks for your answers. --~--~-~--~~~---~--~~ 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: Problems with doctrine:data-load
Thanks to Andrei Dziahel and Eno for your answers. I put this configuration in conf/doctrine/schema.yml # connection: doctrine options: type: INNODB collate: utf8_spanish_ci charset: utf8 and the sql generated for all tables have that options on the CREATE sentence. I test inserting text with phpMyadmin (with this text 'El registro está esperando la aprobación por alguien que tenga las credenciales para hacerlo.') and all text is inserted. I think this say to me that PHP is OK and the database has support for the character set i'm using. Another thing that i did was change the format of data/fitures/ status.yml to utf8 but when i loaded data strange chars appears. I think this is for the codification. After that i changed the condification to ascii (how it was before). At least these chars áéíóú cause that all text don't be inserted. Thanks. On 23 abr, 06:45, Eno symb...@gmail.com wrote: On Wed, 22 Apr 2009, Gary Rojas wrote: The first three records are quoted but it behaves like quotes no exists because the text is trunked how i say before. Is it possible that PHP or your database doesn't have support for your character set? -- --~--~-~--~~~---~--~~ 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] Problems with doctrine:data-load
I'm having a problem with my fixture data. This is a part of data/ fixtures/status.yml pltStatus: pltStatus_ina: id: ina name: Inactivo description: El registro ha sido desactivado por alguien que tiene las credenciales para hacerlo pltStatus_pen: id: pen name: Pendiente: description: El registro está esperando la aprobación por alguien que tiene credenciales para hacerlo All requirements were created correctly (BD, models, sql file, insert sql, etc.). The problem is that the description field has non-ascii characters (in this case 'á') and these chars cause that the description text be cutting when one of these non-ascii chars is found. I think i'm making something wrong in the status.yml because the database definition is well defined. I have tested inserting the description text using a client and all text was inserted ok. I was searching information about how to solve this problem and i didn't found anything. Thanks so much --~--~-~--~~~---~--~~ 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: Problems with doctrine:data-load
I tried all you said me and follow with the same problem. I'm using Symfony 1.2.5 on Windows I read the chapter about symfony configuration on http://www.symfony-project.org/book/1_2/05-Configuring-Symfony This is my complete status.yml file: # pltStatus: pltStatus_ina: id: ina name: Inactivo description: 'El registro ha sido desactivado por alguien que tiene las credenciales para hacerlo' pltStatus_pen: id: pen: name: Pendiente description: 'El registro está esperando la aprobación por alguien que tenga las credenciales para hacerlo.' pltStatus_act: id: act name: Activo description: 'El registro está activo y podrá ser visto por usuarios que tienen las credenciales para hacerlo.' pltStatus_exp: id: exp name: Expirado description: El registro ha alcanzado su periodo de publicación. Normamente el registro llega a este estado de manera automática. pltStatus_eli: id: eli name: Eliminado description: El registro ha sido eliminado por alguien que tiene las credenciales para hacerlo. pltStatus_fin: id: fin name: Finalizado description: El registro ha sido finalizado. Normalmente el registro llega a este estado por intervención del usuario que lo registro. pltStatus_ven: id: ven name: Vendido description: El registro ha sido vendido. Este estado es usado para definir las ordenes de compra. # The first three records are quoted but it behaves like quotes no exists because the text is trunked how i say before. Thanks in advance On 22 abr, 13:02, Andrei Dziahel trickster...@gmail.com wrote: hi. You can also try to enclose descriptions in apostrophes or quotes. 2009/4/22 Gary Rojas gary.r...@gmail.com I'm having a problem with my fixture data. This is a part of data/fixtures/status.yml pltStatus: pltStatus_ina: id: ina name: Inactivo description: El registro ha sido desactivado por alguien que tiene las credenciales para hacerlo pltStatus_pen: id: pen name: Pendiente: description: El registro está esperando la aprobación por alguien que tiene credenciales para hacerlo All requirements were created correctly (BD, models, sql file, insert sql, etc.). The problem is that the description field has non-ascii characters (in this case 'á') and these chars cause that the description text be cutting when one of these non-ascii chars is found. I think i'm making something wrong in the status.yml because the database definition is well defined. I have tested inserting the description text using a client and all text was inserted ok. I was searching information about how to solve this problem and i didn't found anything. Thanks so much --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---