Hi,

On 9 December 2014 at 13:12, Pavel Sokolov <[email protected]> wrote:

> It's very hard to do that with each entity in each DQL query.
>
> For example, Laravel framework has such mechanizm out-of-the-box:
> class User extends Eloquent {
>     protected $hidden = array('password');
> }
>
>
>
This is what we'd call "transient" fields in doctrine (not mapped fields):
plain simple, no hydration, no extraction going on for those fields (also
not in the generated DDL).


> Doctrine 2 uses Annotations to describe all model metadata. So, it will be
> good if  annotation tag like '@Hidden' will be supported.
>

Doctrine handles persistence, not the presentation layer: putting
presentation-layer concerns in the persistence stuff is a violation.


> So, may be exists some way to support custom annotation for model and
> implement 'filter hidden fields' logic based on it?
>

I suggest simply applying `array_map()` over results of your queries. You
can implement automatic filtering yourself by using the
doctrine/annotations library (standalone) with your own annotation
definitions.


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