diff --git a/dbObject.php b/dbObject.php index 0da3881b..6cae5b96 100644 --- a/dbObject.php +++ b/dbObject.php @@ -383,7 +383,7 @@ protected function get ($limit = null, $fields = null) { * @return dbObject */ private function with ($objectName) { - if (!property_exists ($this, 'relations') && !isset ($this->relations[$name])) + if (!property_exists ($this, 'relations') || !isset ($this->relations[$objectName])) die ("No relation with name $objectName found"); $this->_with[$objectName] = $this->relations[$objectName];