Marco,
Before going into too much detail, lets say you want to extend the xml
mapping with a new tag: how would you currently extract the metadata from
the doctrine mapping files?

You can create a 'ClassMetadataFactory', in this class you have to create
the custom drivers using the file locators from doctrine om, and parse the
xml files again a second time looking for the new tag, right? This can
become a nightmare (if done right it won't work in frameworks like Symfony
as you will get a circular reference exception, but that's another story).

I agree on your argument regarding Metadata classes, therefore what would
be great would be to be able to extend the default Metadata class with a
custom one, and be able to parse the custom tags at the same time as
Doctrine tags are being parsed. So first Doctrine metadatas would be
filled, followed by the custom ones.

This would make life much more easy for any developer wanting to extend
Doctrine mapping with custom tags.



2014-11-14 11:17 GMT+00:00 Marco Pivetta <[email protected]>:

> Hi Gonzalo,
>
> For reference, use http://www.doctrine-project.org/jira/browse/DDC-3391
> (that's also where, IMO, discussion should happen)
>
> I'm wondering what the use-case is.
>
> In general, metadata is meant to be a well-formed data structure, not
> containing mixed information. Other software simply uses its own
> `ClassMetadataFactory` to retrieve use-case-specific metadata that is NOT
> the one of the ORM.
>
> Greets,
>
> Marco Pivetta
>
> http://twitter.com/Ocramius
>
> http://ocramius.github.com/
>
> On 14 November 2014 11:32, Gonzalo Vilaseca <[email protected]>
> wrote:
>
>> I've opened an issue in Jira but would like to hear some users opinion:
>>
>> What I'd like to propose is a way of easily extending the metadata
>> information by defining custom tags in mapping files and then add them to
>> Metadata class.
>>
>> So the current problem is this: I want to add custom tags to doctrine
>> metadata files, and then get this tags on a loadClassMetadata listener in
>> order to modify the mapping.
>> Currently the only workaround is parsing this custom tags in the
>> loadClassMetadata listener, going through all the files again.
>>
>> I was thinking of having a new 'extraMetadata' array field in
>> ClassMetadata, every time a driver parses a configuration, throw a new
>> event with the read configuration (being xml, yaml...etc.). A custom
>> listener will parse it according to the new custom tags and return an array
>> that will beappended  to the 'extraMetadata' array field in ClassMetadata.
>>
>> Then, on the loadClassMetadata listener we retrieve this 'extraMetadata'
>> configuration information array, and modify the mapping as we want.
>>
>> Does this make sense?
>>
>>  --
>> 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.
>>
>
>  --
> 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.
>

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