6.0.0-alpha10
▾
Tasks
New Task
Search
Photos
Wiki
▾
Tickets
New Ticket
Search
dev.horde.org
Toggle Alerts Log
Help
5/15/25
H
istory
A
ttachments
C
omment
W
atch
Download
Comment on [#14819] Rdo throws inappropriate exception
*
Your Email Address
*
Spam protection
Enter the letters below:
. ..___.. . . __. | | | |__| |(__ |__| | | |\__|.__)
Comment
> This is in reference to /usr/local/share/pear/Horde/Rdo/Base.php. > > Among the problems I encounterd using a ONE_TO_ONE lazy relationship > is one where "a serious error" problem occurs when the target of the > relationship does not exist. > > IOW I have an Rdo object A with a ONE_TO_ONE lazy relationship to Rdo > object B. If there is no object B an error is thrown upon any attempt > to access B (like in (if empty(B) { do_somthing }). This does not > seem to happen with any of the other relationships and it also > appears to be out of place. > > I commented out line 132 where the Exception is thrown: > > case Horde_Rdo::ONE_TO_ONE: > case Horde_Rdo::MANY_TO_ONE: > if (isset($rel['query'])) { > $query = $this->_fillPlaceholders($rel['query']); > $this->_fields[$field] = $m->findOne($query); > } elseif (!empty($this->{$rel['foreignKey']})) { > //$this->_fields[$field] = > $m->findOne($this->{$rel['foreignKey']}); > $this->_fields[$field] = > $m->findOne(array($rel['foreignKey'] => > $this->{$rel['foreignKey']})); // amended SB 2018-05-23 to fix > ONE_TO_ONE access problem > if (empty($this->_fields[$field])) { > //throw new Horde_Rdo_Exception('The referenced > object with key ' . $this->{$rel['foreignKey']} . ' does not exist. > Your data is inconsistent'); > } > } else { > $this->_fields[$field] = null; > } > break; > > > Please note that the above code comprises another fix I introduced > recently (bug report pending). > > I cannot see a situation where an empty result to the findOne() > should cause an exception - but am of course eager to learn the > better. >
Attachment
Watch this ticket
N
ew Ticket
M
y Tickets
S
earch
Q
uery Builder
R
eports
Saved Queries
Open Bugs
Bugs waiting for Feedback
Open Bugs in Releases
Open Enhancements
Enhancements waiting for Feedback
Bugs with Patches
Enhancements with Patches
Release Showstoppers
Stalled Tickets
New Tickets
Horde 5 Showstoppers