Hi there!

Currently, only PersistentCollection is ORM aware, that is, uses 
ClassMetadata for anything.

When filtering using Criteria, an ArrayCollection uses the following logic 
to check for the value of a field:

   - Call $object->${'get' . $columnName}() if it exists.
   - Otherwise, get the value of $object->$columnName.

This is fair if the type of the object can be any object (even 
non-entities).

However, this leads to severe problems when the object *is* an entity, the 
getter name is not equal to the field name, and the property is private.

Why would I have such a configuration? Simple:

   - The field name contains an under_score.
   - The getter is camelCased.
   - Property is private to force use of the getter/setter.

This problem has been filed as DDC-2838 
<http://www.doctrine-project.org/jira/browse/DDC-2838> (test case is 
provided as an attachment to the ticket).

There are several ways to fix this:

   - Specific fix: Try to convert the field name to camel case and see if 
   that getter exists.
   - Make ArrayCollection ORM aware (optionally of course, to limit 
   breakage of existing code).
   - Derive an ORM aware subclass from ArrayCollection.

The first method seems easiest to implement, but doesn't really fix the 
core issue: that a collection-valued getter might either return something 
that knows about metadata or something that just makes some educated 
guesses.

The second seems like it's tackling the issue in the wrong place (using 
Metadata in Common seems like a forward-dependency that should be avoided).

The third idea seems to me like the way to go, but also adds complexity 
(separate implementation of the matching() method, new intermediate class 
that might break things).

Any opinions / comments / suggestions on this?

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