Minor logic and formatting changes. Considering making Linkable operate recursively.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@354 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -130,11 +130,18 @@ class LinkableBehavior extends ModelBehavior {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function beforeFind(&$Model, $query) {
|
public function beforeFind(&$Model, $query) {
|
||||||
|
return $this->buildQuery($Model, $query);
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildQuery(&$Model, $query) {
|
||||||
$this->pr(10,
|
$this->pr(10,
|
||||||
array('function' => 'Linkable::beforeFind',
|
array('function' => 'Linkable::buildQuery',
|
||||||
'args' => array('Model->alias' => '$Model->alias') + compact('query'),
|
'args' => array('Model->alias' => '$Model->alias') + compact('query'),
|
||||||
));
|
));
|
||||||
if (isset($query[$this->_key])) {
|
|
||||||
|
if (!isset($query[$this->_key]))
|
||||||
|
return $query;
|
||||||
|
|
||||||
$optionsDefaults = $this->_defaults + array('reference' =>
|
$optionsDefaults = $this->_defaults + array('reference' =>
|
||||||
array('class' => $Model->alias,
|
array('class' => $Model->alias,
|
||||||
'alias' => $Model->alias),
|
'alias' => $Model->alias),
|
||||||
@@ -421,7 +428,7 @@ class LinkableBehavior extends ModelBehavior {
|
|||||||
++$cont;
|
++$cont;
|
||||||
$notDone = isset($iterators[$cont]);
|
$notDone = isset($iterators[$cont]);
|
||||||
} while ($notDone);
|
} while ($notDone);
|
||||||
}
|
|
||||||
$this->pr(20,
|
$this->pr(20,
|
||||||
array('function' => 'Linkable::beforeFind',
|
array('function' => 'Linkable::beforeFind',
|
||||||
'return' => compact('query'),
|
'return' => compact('query'),
|
||||||
|
|||||||
Reference in New Issue
Block a user