thank you Sid for your reply...
do you mean that the way I used [$profile = new Profile()] is correct to use
`Profile` model in `User` controller?

providing in details there are two models, User and Profile and both are
dependent using user_id in Profile Model.
Now scenario  is  that just after adding User I want to add user_id and
profile info in Profile model.
Here after $user->save();

$profile = new Profile();
$profile->setUserId($user->getId());
$profile->setContent(...);
$profile->save();

is this a good way or this can be done by using following methods available
in $user object...

    [41] => clearProfiles
    [42] =>* init*Profiles
    [43] => getProfiles
    [44] => countProfiles
    [45] => *add*Profile

I have used $user->getProfiles() method in another action after adding
profile info but I am not sure *about other two methods in bold*. My
consideration is that I don't want to create extra new Profile object when
some methods are already available to do the same work. Hopefully my
consideration make sense.

Regards
Krishan.

On Tue, Aug 25, 2009 at 2:33 AM, Sid Bachtiar <[email protected]>wrote:

>
> You can use multiple models in a controller (action). The controller
> name may be the same as a model name, but doesn't restrict that
> controller to that one model.
>
> On Mon, Aug 24, 2009 at 7:37 PM, krishan<[email protected]> wrote:
> >
> > Hi devs,
> >
> > I want to use another model in my controller. For eg.. I have users
> > and profile controllers.(two separate modules)  when somebody register
> > himself I save the registration info in user model. At the same time
> > in process form I want to save some basic info in profile model for
> > which I have not taken any info on registration page.
> >
> > I got one ides like using $profile = new Profile() in user controller.
> > Is this is perfect solution to use another model on controller. Or
> > there is other way to do this?
> >
> > krishan
> >
> >
> > >
> >
>
>
>
> --
> Blue Horn Ltd - System Development
> http://bluehorn.co.nz
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to