2014-11-25 20:41 GMT+01:00 Christophe COEVOET <[email protected]>:

> Le 25/11/2014 19:46, Sebastian Krebs a écrit :
>
>> Hi,
>>
>> Very simple question: Is it possible to use XML (or yaml, ... anything
>> else than annotations ;)) with traits?
>>
>> Regards,
>> Sebastian
>>
> It depends of what you want to achieve. You can define mapping for fields
> provided by a trait, but you need to define it as if fields were directly
> in the class using the trait. You cannot provide mapping for the trait
> itself.
>

That's exactly, what I wondered. With annotation it works, but that makes
sense: The fields come with their mapping "built in".

Many thanks for your answer anyway :)


>
> This is logical given the way traits are working in PHP. They are
> compiler-based copy/paste. They don't exist during the runtime of the
> class. The reason why annotations can be defined in an handy way for traits
> is because they are copy/pasted too (but the loading is actually done for
> the class, not for the trait)


Makes sense .... Maybe something like an import would be useful?

<entity>
    <inherit class="TraitName" />
</entity>

I don't know, if that's even possible.


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



-- 
github.com/KingCrunch

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