Seems like a better question for the symfony users group, but
something like this should work. You'll have to create setNbVotes()
and getNbVotes() methods in your Video class.
$c = new Criteria;
VideoPeer::addSelectColumns($c);
$c->addSelectColumn(VideoVotesPeer::COUNT);
$c->addJoin(VideoPeer::ID, VideoVotesPeer::VIDEO_ID,
Criteria::LEFT_JOIN);
$c->addGroupByColumn(VideoPeer::ID);
$rs = VideoPeer::doSelectRS($c);
$videos = array();
while ($rs->next())
{
$video = new Video;
$colNum = $video->hydrate($rs);
$video->setNbVotes($rs->getInt($colNum));
$videos[] = $videos;
}
On Feb 22, 11:03 am, andreliem <[EMAIL PROTECTED]> wrote:
> here's my scenario:
>
> $videoCriteria = new Criteria();
> $videoCriteria->addAsColumn('votecount',
> 'COUNT('.MlVideoVotesPeer::ML_VIDEO_ID.')');
> $videos = MlVideoPeer::doSelect($videoCriteria);
>
> foreach($this->videos as $video)
> {
> //do something with each video record
> //can't retrieve custom valued defined in "addAsColumn"
>
> }
>
> I'm pretty sure I could retrieve the value if I returned a regular
> record set, but then you lose the ability to retrieve values by method
> name.... this should be easy to do. Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony developers" 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-devs?hl=en
-~----------~----~----~----~------~----~------~--~---