Hi Oleg,

On 17 December 2014 at 10:00, Oleg Fetisov <[email protected]> wrote:
>
> 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!
>
> --
>

This is not supported by Doctrine mappers at the moment.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

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

Reply via email to