removing variables that are unnecessarily used

This commit is contained in:
dogmatic69 2012-12-05 10:55:11 +00:00
parent 0ada30f3bc
commit b92b7c2d2d

View file

@ -2482,7 +2482,7 @@ class Model extends Object implements CakeEventListener {
*/ */
protected function _deleteLinks($id) { protected function _deleteLinks($id) {
foreach ($this->hasAndBelongsToMany as $data) { foreach ($this->hasAndBelongsToMany as $data) {
list($plugin, $joinModel) = pluginSplit($data['with']); list(, $joinModel) = pluginSplit($data['with']);
$records = $this->{$joinModel}->find('all', array( $records = $this->{$joinModel}->find('all', array(
'conditions' => array($this->{$joinModel}->escapeField($data['foreignKey']) => $id), 'conditions' => array($this->{$joinModel}->escapeField($data['foreignKey']) => $id),
'fields' => $this->{$joinModel}->primaryKey, 'fields' => $this->{$joinModel}->primaryKey,
@ -2581,9 +2581,13 @@ class Model extends Object implements CakeEventListener {
if ($id === false) { if ($id === false) {
return false; return false;
} }
$conditions = array($this->alias . '.' . $this->primaryKey => $id); return (bool)$this->find('count', array(
$query = array('conditions' => $conditions, 'recursive' => -1, 'callbacks' => false); 'conditions' => array(
return $this->find('count', $query) > 0; $this->alias . '.' . $this->primaryKey => $id
),
'recursive' => -1,
'callbacks' => false
));
} }
/** /**