php - Doctrine2 Define properties via magic methods -


using doctrine, possible map properties don't exist using magic methods?

i'm doing mapping yaml.

for example, if wanted map property named "demo", someclass::$demo didn't exist. i'd want combination of __get(), __set(), __isset() , __call() handle $demo (and getdemo() , setdemo()) , else them.

i've tried setting up, i'm getting error:

uncaught exception 'reflectionexception' message 'property my\bundle\demobundle\entity\someclass::$demo not exist' 

i'm not sure if there special reflectionproperty causes miss magic methods, or if i'm maybe missing magic function. however, far can tell, reflectionproperty should interact them.

any ideas?

update:

upon further investigation, looks reflectionproperty constructor throw exception , won't trigger magic methods.

does else know of means map doctrine dynamic properties?

thanks.

update 2:

to example i'm trying accomplish.

basically, have generic user object contains base properties needed handle being user (roles, password, salt, username, etc.). however, want able extend object add application-and-user-specific meta data.

so, create forum bundle. dynamically hook meta data related user use forum. don't want put directly in user bundle, because user bundle becomes less flexible.

if somehow dynamically inject new data in user, loaded in single query user, instead of having loaded in separate query. know there other methods this, i've explored , used limited extend. however, it'd nicer if dynamically create these associations, shouldn't difficult of leap.

if don't need search on these dynamic properties add property called data entity , map doctrine array type. majic stuff , store dynamic properties in data array.

a second approach might along these lines: http://symfony.com/doc/current/cookbook/doctrine/resolve_target_entity.html. each installation might able give administrators of making custom entity.

but long don't need directly query on dynamic properties first method works well.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -