Loading...

dev@lists.horde.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [dev] [Tickets #10880] Rdo drops objects from result when eager relation target is NULL or invalid key Ralf Lang Wed Feb 22 00:00:28 2012

Am 21.02.2012 13:59, schrieb Chuck Hagenbuch:
On Feb 21, 2012, at 3:12 AM, Ralf Lang<[EMAIL PROTECTED]>  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...


Can't disagree, it's uglier than it should be.

It's working around PHP's inconsistent use of fatals vs exceptions. I've raised this on the PHP-dev list, with mixed results. Most responses were programming patterns, the NoValue object in several incarnations. One "I don't like it but write an RFC" and a few "any fatal which becomes an exception is a step forward". I'll probably write that RFC and see how the php devs feel about it.

I withdraw the exception idea now. But I'll try to fix the original $subject asap.

--
Ralf Lang
Linux Consultant / Developer
Tel.: +49-170-6381563
Mail: [EMAIL PROTECTED]

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: [EMAIL PROTECTED]