enhanced InvalidKeyException messages
This commit is contained in:
parent
d052826003
commit
b7bf2265ef
@ -38,11 +38,11 @@ class Doctrine_Query extends Doctrine_Hydrate {
|
|||||||
$where = $this->where;
|
$where = $this->where;
|
||||||
$having = $this->having;
|
$having = $this->having;
|
||||||
|
|
||||||
$q = "SELECT COUNT(1) FROM ".$table." ";
|
$q = "SELECT COUNT(1) FROM ".$table->getComponentName()." ";
|
||||||
foreach($join as $j) {
|
foreach($join as $j) {
|
||||||
$q .= implode(" ",$j);
|
$q .= implode(" ",$j);
|
||||||
}
|
}
|
||||||
$string = $query->applyInheritance();
|
$string = $this->applyInheritance();
|
||||||
|
|
||||||
if( ! empty($where)) {
|
if( ! empty($where)) {
|
||||||
$q .= " WHERE ".implode(" AND ",$where);
|
$q .= " WHERE ".implode(" AND ",$where);
|
||||||
@ -56,7 +56,7 @@ class Doctrine_Query extends Doctrine_Hydrate {
|
|||||||
if( ! empty($having))
|
if( ! empty($having))
|
||||||
$q .= " HAVING ".implode(' AND ',$having);
|
$q .= " HAVING ".implode(' AND ',$having);
|
||||||
|
|
||||||
$a = $this->table->getSession()->execute($q, $params)->fetch(PDO::FETCH_NUM);
|
$a = $this->getSession()->execute($q, $params)->fetch(PDO::FETCH_NUM);
|
||||||
return $a[0];
|
return $a[0];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -398,7 +398,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
|||||||
*/
|
*/
|
||||||
final public function getBound($name) {
|
final public function getBound($name) {
|
||||||
if( ! isset($this->bound[$name]))
|
if( ! isset($this->bound[$name]))
|
||||||
throw new InvalidKeyException();
|
throw new InvalidKeyException('Unknown bound '.$name);
|
||||||
|
|
||||||
return $this->bound[$name];
|
return $this->bound[$name];
|
||||||
}
|
}
|
||||||
@ -414,7 +414,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
|||||||
return $this->bound[$k];
|
return $this->bound[$k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new InvalidKeyException();
|
throw new InvalidKeyException('Unknown bound '.$name);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* returns the alias for given component name
|
* returns the alias for given component name
|
||||||
@ -438,7 +438,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
|||||||
if($name = array_search($this->boundAliases,$alias))
|
if($name = array_search($this->boundAliases,$alias))
|
||||||
return $name;
|
return $name;
|
||||||
|
|
||||||
throw new InvalidKeyException();
|
throw new InvalidKeyException('Unknown alias '.$alias);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* unbinds all relations
|
* unbinds all relations
|
||||||
@ -480,7 +480,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
|||||||
*/
|
*/
|
||||||
final public function bind($name,$field,$type,$localKey) {
|
final public function bind($name,$field,$type,$localKey) {
|
||||||
if(isset($this->relations[$name]))
|
if(isset($this->relations[$name]))
|
||||||
throw new InvalidKeyException();
|
throw new InvalidKeyException('Relation already set for '.$name);
|
||||||
|
|
||||||
$e = explode(" as ",$name);
|
$e = explode(" as ",$name);
|
||||||
$name = $e[0];
|
$name = $e[0];
|
||||||
@ -540,6 +540,8 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
|||||||
* @return Doctrine_Relation
|
* @return Doctrine_Relation
|
||||||
*/
|
*/
|
||||||
final public function getForeignKey($name) {
|
final public function getForeignKey($name) {
|
||||||
|
$original = $name;
|
||||||
|
|
||||||
if(isset($this->relations[$name]))
|
if(isset($this->relations[$name]))
|
||||||
return $this->relations[$name];
|
return $this->relations[$name];
|
||||||
|
|
||||||
@ -614,7 +616,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
|
|||||||
$this->relations[$alias] = $relation;
|
$this->relations[$alias] = $relation;
|
||||||
return $this->relations[$alias];
|
return $this->relations[$alias];
|
||||||
}
|
}
|
||||||
throw new InvalidKeyException();
|
throw new InvalidKeyException('Unknown relation '.$original);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* returns an array containing all foreign key objects
|
* returns an array containing all foreign key objects
|
||||||
|
Loading…
x
Reference in New Issue
Block a user