On Wednesday, November 26, 2014 2:47:17 PM UTC-8, Marco Pivetta wrote:
>
>
>> @Sebastian, my feeling is this would allow better re-use of Entities 
>> amongst different projects. My feeling is that when the XML Driver supports 
>> it and the metadata "does not know" where it comes from, it should be 
>> feasible, since a Trait is a run-time copy-paste of code as well. Whether 
>> it would preferred to put energy into this... not sure, also see 
>> Benjamin's stance on Traits 
>> <http://www.google.com/url?q=http%3A%2F%2Fwww.whitewashing.de%2F2013%2F04%2F12%2Ftraits_are_static_access.html&sa=D&sntz=1&usg=AFQjCNEfBVhDC8Y7g20dK0wtR-8hdR-PQQ>
>> .
>>
>
> I don't think I ever saw a use-case for re-using traits in first place, so 
> I don't think it's useful to go down the rabbit hole to find out that we 
> are solving the 0.1% use-case.
>

I use traits to remove duplicate code in my project. In the example below 
you can see that the XML mapping has unnecessary duplicate code. It seems 
strange to support trait annotation mapping and not also support XML 
mapping of traits. +1 for adding this feature.

trait CommonTrait {
    protected $id;
    protected $created;
    protected $updated;
}

class Product {
 use CommonTrait;
}
class Image {
 use CommonTrait;
}
class Tag {
 use CommonTrait;
}

<entity name="Product" table="product">
    <id name="id" type="integer" />
    <field name="created" type="integer" />
    <field name="updated" type="integer" />
</entity>
<entity name="Image" table="coupon">
    <id name="id" type="integer" />
    <field name="created" type="integer" />
    <field name="updated" type="integer" />
</entity>
<entity name="Tag" table="coupon">
    <id name="id" type="integer" />
    <field name="created" type="integer" />
    <field name="updated" type="integer" />
</entity>

 

> Also consider that traits have no actual meaning on their own until used 
> in a concrete implementation. 
>
What I can think of is allowing marking traits as MappedSuperclasses, which 
> would indeed fit the concept.
>
> 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