[dev] [Tickets #10880] Rdo drops objects from result when eager relation target is NULL or invalid key
Ralf Lang
lang at b1-systems.de
Fri Jan 13 10:09:42 UTC 2012
Hi List,
Ticket URL: http://bugs.horde.org/ticket/10880
> ------------------------------------------------------------------------------
>
> Ticket | 10880
> Updated By | Ralf Lang (B1 Systems GmbH) <lang at b1-systems.de>
> Summary | Rdo: Make *- to-one-relations aware of "no
> relation"
> | state
> Queue | Horde Framework Packages
> Version | Git master
> Type | Enhancement
> State | Feedback
> Priority | 1. Low
> Milestone |
> Patch |
> Owners |
> ------------------------------------------------------------------------------
>
>
>
> Ralf Lang (B1 Systems GmbH) <lang at b1-systems.de> (2012-01-09 21:31)
> wrote:
>
> It seems like lazy [one|many]_to_one relations are resolved by a
> different part of code than eager relations.
>
> lazy relations:
> Base.php __get triggers a findOne on the target mapper with either a
> supplied query object (undocumented?) or the defined foreignKey
> field's value. A findOne without restrictions catches the first
> object, if any exist or null otherwise. I think I have fixed THIS
>
> eager relations:
> REFERENCING Objects with broken eager relations of either type (null
> value or wrong key value) simply aren't created. No exception is
> thrown until code wants to access the object's properties.
> This seems to be handled by Horde_Rdo_Query generating an INNER JOIN
> which results in no object
> No idea how to tackle this.
>
>
>
>
I've been thinking about this for a while now. The lazy relation thing
is fixed: Accessing a to-one-relation where the reference key is invalid
(does not exist) now throws Rdo Exception, accessing a reference key of
NULL returns null instead of the first possible object.
I have no clear strategy to fix eager relations:
As my test cases show, Objects which reference either NULL keys or
invalid keys will simply not be loaded from database although they exist.
An idea would be to use the lazy loading code but execute it immediately
(will be slower than join for larger data sets).
Is there a portable Sql which says "take result of join result table but
add distinct keys from another sql statement"?
--
Ralf Lang
Linux Consultant / Developer
Tel.: +49-170-6381563
Mail: lang at b1-systems.de
B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
More information about the dev
mailing list