But I think a join makes sense in this case. I don't want to query the
database 50x if a page has 50 items. What must be added to my
doSelectJoinAll code?
On Wed, Mar 5, 2008 at 12:53 PM, Lee Bolding <[EMAIL PROTECTED]> wrote:
> in that case change it to $user->getVotes($item)
>
>
>
> in your getVotes method be sure to specify in your constructor (Item $item
> = NULL) so that it's an optional param.
>
>
>
> You can still then use $user->getVotes()
>
>
>
> I tend to also make an optional array so that I can return a PropelPager
> object if I want instead of a huge array of objects. You'd have to think
> about how to deal with what to do if your item was null then though...
> probably create $user->findVotesByItem($item, $options = NULL) and
> $user->findVotes($options = NULL);
>
>
>
> Eg. $user->findVotesByItem($item, array('page' => 3, 'orderby' =>
> VotePeer::NAME));
>
>
>
>
>
> J
>
>
>
> *From:* [email protected] [mailto:
> [EMAIL PROTECTED] *On Behalf Of *Alex
> *Sent:* 05 March 2008 15:20
>
> *To:* [email protected]
> *Subject:* [symfony-users] Re: sfUser in Model
>
>
>
> Thank you for your reply,
>
> I don't want to get all of a user's votes. I want to join his votes to the
> items listing. If he has 10000 votes and I'm listing 5 items, I would like
> to join his possible 5 votes.
>
>
> On Wed, Mar 5, 2008 at 12:13 PM, Lee Bolding <[EMAIL PROTECTED]> wrote:
>
>
> I'd look at a way of putting the functionality to get a users votes into
> the
> extended USER object, not the vote object. $user->getVotes() would be far
> cleaner IMO.
>
> You can probably make Symfony automatically work out the dirty work with a
> correctly configured schema.yml - maybe not on the user object itself (not
> entirely sure about that), but certainly on sfGuardUserProfile if you are
> using sfGuard ($user->getProfile()->getVotes(); or to get a vote item...
>
> $user->getProfile()->getVote($pk)->getItem();
>
> I extended ACLActions and made a preExecute method to always place the
> logged in users account and profile into the context (as $this->user and
> $this->profile) - makes things much easier :)
>
>
> -----Original Message-----
> From: [email protected] [mailto:
> [EMAIL PROTECTED]
> On Behalf Of Nicolas Perriault
> Sent: 05 March 2008 15:00
> To: [email protected]
> Subject: [symfony-users] Re: sfUser in Model
>
>
> On Wed, Mar 5, 2008 at 3:00 PM, Alex <[EMAIL PROTECTED]> wrote:
>
> > I have three models: votes, items, votes_items, and users.
>
> Hem, sounds like you should give a look to
> sfPropelActAsRatableBehaviorPlugin</advertisement> ^^
>
> > My question is: how do I access the sfUser object from within the model?
>
> sfContext::getInstance()->getUser()
>
> HTH
>
> ++
>
> --
> Nicolas Perriault
> http://prendreuncafe.com/blog
> GSM: 06.60.92.08.67
>
>
>
>
>
>
>
>
> --
>
> - Alex
>
> >
>
--
- Alex
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---