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 <interpret...@gmail.com> 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 <alan....@gmail.com> 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 <to...@tomor.cz> > > > > > > > > > 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 <interpret...@gmail.com> 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<symfony-users%2bunsubscr...@googlegroups.com> > <symfony-users%2bunsubscr...@goog 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<symfony-users%2bunsubscr...@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