Hi guys! Im looking for a good way for implementing some kind of wrapper on
those collection (EmbedMany). The target is:
when i'm loading data from DB and hydrate it, i want to have not
PersistentColection but my own wraper which will have some specific
methods. For ex.:
class CommentsCollection extends (?)
{
public function getPositiveComments() {
return $this->filter(function ($element) {
return $element->getMood() == Comment::MOOD_POSITIVE;
})
}
}
And in model:
/**
* @ODM\EmbedMany(targetDocument="Comment")
* @var CommentsCollection
*/
protected $comments;
public function getPositiveCommentsCount()
{
return count($this->comments->getPositiveComments());
}
It's not the best example but i think the idea should be clear. Or maybe
you have better ideas? Thanks in advance!
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.