[dev] [Tickets #10880] Rdo drops objects from result when eager relation target is NULL or invalid key

Chuck Hagenbuch chuck at horde.org
Tue Feb 21 12:59:48 UTC 2012


On Feb 21, 2012, at 3:12 AM, Ralf Lang <lang at b1-systems.de> wrote:

>> 
>> I'm hesitant to make this an exception, though. I see your use case, but
>> for non-nested use, it means that I have to put a try/catch around
>> property testing when I could otherwise just use if checks (duck typing,
>> etc)...
>> 
>> -chuck
> 
> You can check the relation key for a non-null value. But I see the issue too.
> 
> Another approach would be a "null" response object that only throws an exception if the user tries to access attributes or methods of the response. Both the Rdo_Base object and the "null" object would need to implement a simple true-false-interface which could be checked similarly to your former if ($object) {}. At least in my use cases, porting would be easy.

That seems hackish and error prone, IMO...

> Countable comes to mind, though it feels a bit like abuse.
> 
> Even better would be if the null response object itself could evaluate to null, false, 0 or "" but I haven't read changelog on the builtin interfaces/magic methods in a while.
> 
> 
> 
> -- 
> 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
> -- 
> Horde developers mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org


More information about the dev mailing list