Re: [symfony-users] Re: How i can implement this with sfGuard plugin
In your fixtures check if you are indeed assigning a valid sfGuardUser to the user_id field of "rank_domain" objects On Tue, Aug 17, 2010 at 2:12 AM, RusAlex wrote: > Can you explain please: > I've tried to add relation to schema.yml > > RankDomain: > columns: >name: { type: string(255), notnull: true, unique: true } >user_id: { type: integer, notnull:true } > relations: >sfGuardUser: { local: user_id, foreign: id } > > But when i type command: > php symfony doctrine:build --all --and-load > > I have an error: > SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or > update a child row: a foreign key constraint fails > (`ranks`.`rank_domain`, CONSTRAINT > `rank_domain_user_id_sf_guard_user_id` FOREIGN KEY (`user_id`) > REFERENCES `sf_guard_user` (`id`)) > > > On Aug 15, 1:28 am, Alan Bem wrote: > > Wouldn't it be better? > > > > $this->getUser()->getGuardUser()->getJobs()? > > > > You just need to add proper relation between sf_guard_user and job > tables. > > > > 2010/8/14 Tom Ptacnik > > > > > > > > > Maybe better would be to store the id of the user not the username. > > > But the principle is right. > > > > > And this code of creating the query move to the JobTable class .. > > > create a method with userId parametter. > > > > > On 12 srp, 21:16, RusAlex wrote: > > > > I have my own opinion: > > > > > > I need to add new field "user" into job table, and use edited actions > > > > to show: > > > > > > class jobActions extends sfActions > > > > { > > > > public function executeIndex(sfWebRequest $request) > > > > { > > > > $this->jobs = Doctrine::getTable('JobeetJob') > > > > ->createQuery('a') > > > > ->where('a.user = ?' , $this->getUser()->getUsername()) > > > > ->execute(); > > > > } > > > > > > Is this a right approach for solving my task ? > > > > > -- > > > 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 > -- 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 i can implement this with sfGuard plugin
Can you explain please: I've tried to add relation to schema.yml RankDomain: columns: name: { type: string(255), notnull: true, unique: true } user_id: { type: integer, notnull:true } relations: sfGuardUser: { local: user_id, foreign: id } But when i type command: php symfony doctrine:build --all --and-load I have an error: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`ranks`.`rank_domain`, CONSTRAINT `rank_domain_user_id_sf_guard_user_id` FOREIGN KEY (`user_id`) REFERENCES `sf_guard_user` (`id`)) On Aug 15, 1:28 am, Alan Bem wrote: > Wouldn't it be better? > > $this->getUser()->getGuardUser()->getJobs()? > > You just need to add proper relation between sf_guard_user and job tables. > > 2010/8/14 Tom Ptacnik > > > > > Maybe better would be to store the id of the user not the username. > > But the principle is right. > > > And this code of creating the query move to the JobTable class .. > > create a method with userId parametter. > > > On 12 srp, 21:16, RusAlex wrote: > > > I have my own opinion: > > > > I need to add new field "user" into job table, and use edited actions > > > to show: > > > > class jobActions extends sfActions > > > { > > > public function executeIndex(sfWebRequest $request) > > > { > > > $this->jobs = Doctrine::getTable('JobeetJob') > > > ->createQuery('a') > > > ->where('a.user = ?' , $this->getUser()->getUsername()) > > > ->execute(); > > > } > > > > Is this a right approach for solving my task ? > > > -- > > 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 > legroups.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] Re: How i can implement this with sfGuard plugin
getGuardUser() can return a null value. Take care of it. Using a method on the table is smartest (I think) : Doctrine::getTable('Jobs')->findByAuthor($this->getUser()->getGuardUser()); 2010/8/14 Alan Bem > Wouldn't it be better? > > $this->getUser()->getGuardUser()->getJobs()? > > You just need to add proper relation between sf_guard_user and job tables. > > 2010/8/14 Tom Ptacnik > > Maybe better would be to store the id of the user not the username. >> But the principle is right. >> >> And this code of creating the query move to the JobTable class .. >> create a method with userId parametter. >> >> >> On 12 srp, 21:16, RusAlex wrote: >> > I have my own opinion: >> > >> > I need to add new field "user" into job table, and use edited actions >> > to show: >> > >> > class jobActions extends sfActions >> > { >> > public function executeIndex(sfWebRequest $request) >> > { >> > $this->jobs = Doctrine::getTable('JobeetJob') >> > ->createQuery('a') >> > ->where('a.user = ?' , $this->getUser()->getUsername()) >> > ->execute(); >> > } >> > >> > Is this a right approach for solving my task ? >> >> -- >> 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 > -- Alexandre Salomé http://alexandre-salome.fr -- 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: How i can implement this with sfGuard plugin
Wouldn't it be better? $this->getUser()->getGuardUser()->getJobs()? You just need to add proper relation between sf_guard_user and job tables. 2010/8/14 Tom Ptacnik > Maybe better would be to store the id of the user not the username. > But the principle is right. > > And this code of creating the query move to the JobTable class .. > create a method with userId parametter. > > > On 12 srp, 21:16, RusAlex wrote: > > I have my own opinion: > > > > I need to add new field "user" into job table, and use edited actions > > to show: > > > > class jobActions extends sfActions > > { > > public function executeIndex(sfWebRequest $request) > > { > > $this->jobs = Doctrine::getTable('JobeetJob') > > ->createQuery('a') > > ->where('a.user = ?' , $this->getUser()->getUsername()) > > ->execute(); > > } > > > > Is this a right approach for solving my task ? > > -- > 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: How i can implement this with sfGuard plugin
Maybe better would be to store the id of the user not the username. But the principle is right. And this code of creating the query move to the JobTable class .. create a method with userId parametter. On 12 srp, 21:16, RusAlex wrote: > I have my own opinion: > > I need to add new field "user" into job table, and use edited actions > to show: > > class jobActions extends sfActions > { > public function executeIndex(sfWebRequest $request) > { > $this->jobs = Doctrine::getTable('JobeetJob') > ->createQuery('a') > ->where('a.user = ?' , $this->getUser()->getUsername()) > ->execute(); > } > > Is this a right approach for solving my task ? -- 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 i can implement this with sfGuard plugin
I have my own opinion: I need to add new field "user" into job table, and use edited actions to show: class jobActions extends sfActions { public function executeIndex(sfWebRequest $request) { $this->jobs = Doctrine::getTable('JobeetJob') ->createQuery('a') ->where('a.user = ?' , $this->getUser()->getUsername()) ->execute(); } Is this a right approach for solving my task ? -- 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