Show us the schema.yml or schema.xml On 3/19/07, Craig Boxall <[EMAIL PROTECTED]> wrote: > > Thanks Ant, > > Yes getCreatedBy() returns the id of the user (which in this case is > "1") so myscript echoes > "Created by 1" > Instead of: > "Created by Craig" > > > I tried what you suggest and I get the following error: > > Call to undefined method Project::getUser() > > when trying: > > $project->getUser()->getNameFirst(); > > Any suggestions? > > Cheers > > > > On 19/03/2007, at 3:52 PM, Ant Cunningham wrote: > > > > > I believe getCreatedBy() is only giving you the ID not the object > > it is > > linking to. try using $project->getUser()->getFirstName(); it seems > > odd > > because youre not using the default naming pattern (ie. user_id as > > a value > > is getUserID(), user as an object is getUser()), the proxy to get the > > related record is created by the related class name, not the column > > name. > > > > **I think** > > > > :-) > > > > > > On 3/18/07 11:11 PM, "Craig Boxall" <[EMAIL PROTECTED]> wrote: > > > >> > >> Hi everyone, > >> > >> This is my first post to the symfony group so go easy on me :) Im > >> also super-new at Symfony and I have what I imagine is a simple > >> question. > >> > >> I have two modules > >> > >> -> Project > >> -> User > >> > >> One of the fields in my Project table is created_by to store the ID > >> of the user who created the project. I have set up a foreign key to > >> link this to the User table. > >> > >> When creating new records it gives me a drop down of all the records > >> in my user table (by ID number not name) so I am able to capture a > >> user just fine. > >> > >> Now when I list the Projects, I want to be able to do something like: > >> > >> $project->getCreatedBy()->getFirstName() > >> > >> But this gives me a cannot call method on non-object error. > >> > >> Any suggestions how I make this work? > >> > >> Thanks to any help. > >> > >> regards > >> Craig > >> > >> > >>> > > > > > > > > > > > > > >
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---
