It's clear for me. I lernt it when I've analysed code of 
AbstractClassMetadataFactory. I just thought there is some workaround which 
use interitance.

Thanks for Interest in my problem. :)
.
W dniu środa, 22 października 2014 12:24:45 UTC+2 użytkownik Jàπ (Jasper N. 
Brouwer) napisał:
>
> This sounds like you're using tools to do a job those tools where not 
> designed for. I can see why you're hitting a few problems. 
>
> Putting that aside, here's what's going on: 
>
> When Doctrine needs mapping metadata, it will read the configuration files 
> (or annotations), parse them and build metadata classes. Those classes are 
> then cached so the reading/parsing/building doesn't have to be done on each 
> request. This will significantly improve performance. 
>
> The loadClassMetadata event is dispatched _after_ that process. So from 
> the event-listener's point of view, it doesn't matter if the metadata was 
> read from cache or reading/parsing/building was doen, it simple receives a 
> metadata object. I'm afraid there's nothing you can really do (except for 
> forking Doctrine and making changes at a core level) to hook into the 
> reading/parsing/building/caching part. 
>
> If your event-listener simply adds some info to the metadata without using 
> any collaborators, there's no need to use a cache there. As I've said, you 
> can't "recache" the metadata-class, so you're going to have to add that 
> info on every request. 
>
> If you're doing something dynamic to build the info you're adding to the 
> metadata, you could implement you own caching strategy. You could even 
> inject Doctrine' metadata cache driver into your event-listener. 
>
> I hope this clears some things up for you :) 
>
> --   
> Jasper N. Brouwer 
> (@jaspernbrouwer) 
>
>
> On 22 October 2014 at 11:59:59, [email protected] <javascript:> (
> [email protected] <javascript:>) wrote: 
> > I use sonata admin project. It's admin for symfony2. I have two admin 
> > modules. Modules depends on entities. First module shows data from my 
> > table. Second module shows only few columns from the same table. 
> Moreover 
> > it shows data from another database, which is not created for doctrine. 
> >   
> > What I've tried: 
> > 1. I made one entity and change metadata in loadClassMetadata event. 
> After 
> > that I used postLoad event to get and process data from 'non-doctrine' 
> > database and fill entity. It works without cache, as I wrote above. 
> > 2. Single Table inheritance. It's creating column in database after 
> which 
> > doctrine chooses rows but I need the same rows in both modules. 
> > 3. Creating another entity with the same table name, obviously case 
> problem 
> > with update database schema. 
> >   
> > Creating entity and inheriting from existing entity could be a solution. 
> I 
> > would have two class and doctrine cache them separately. I don't know 
> > whether it's possible at all. 
> > I need metadata because sonata depends on it. 
> >   
> > Sorry for my english but I hope it's readable.. 
>
>
>

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