Hi,

Simple setup. Longer Story :-)

Table Agency with various fields
Table Mandator with various fields

mandatorId is a FK in Agency.

I use the DoctrineEntity Hydrator in the Forms.

For all ID's where the mandatorId is NOT 1 its working. if its 1 it fails.

The only difference is the user which I'm logged in also belongs to
mandatorId 1. (i can reproduce it, if I change this users mandatorId to
eg. 3 then 3 will fail and 1 will work)

And here comes the funny part.
As soon as Doctrine uses the Proxy Class and not the Entity itself, the
id is of type String and this invokes the notice.

its kinda hard to explain, but take a look at the gist, and you will see
what i mean.
https://gist.github.com/4063648

This are var_dumps of $attributes from the
Zend\Stdlib\Hydrator\ClassMethods::extract method:
 in the working version (
https://gist.github.com/4063648#file_1_working%20version ) the mandator
is of type Admin\Entity\Mandator and has an protected mandatorId.


in the failing version (
https://gist.github.com/4063648#file_2_faling%20version ) the mandator
is of type DoctrineORMModule\Proxy\__CG__\Admin\Entity\Mandator which
have the mandatorId but it seems it cant be found by extractValue.

I'm sure this is a bug, but I can't figure out where it originates:
Doctrine\ORM\Persisters\BasicEntityPersister?
DoctrineORMModule?
DoctrineEntity Hydrator?
Zend ClassMethods Hydrathor?

As you can see in the failing version, the mandatorId in the _identifier
Array is of type string. (which leads to the notice).

my last try to quick fix this, was to typecast the getMandatorId method
in the Entity, as you can see in the proxy class generated by doctrine (
https://gist.github.com/4063648#file_8_mandator%20proxy.php ) if its not
initialized its already casted to int.
But as the notice talks about EntityPersister i guess it is initialized
and it "__loads" the entity. as this is using parent::getMandatorId() an
forced cast to int should help... but it didn’t.

So I'm currently out of ideas, I wasted the last couple hours on this.
Any help would be much appreciated.


TIA Ludwig

-- 
Ludwig Ruderstaller
http://www.cwd.at

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to