Commit f6fa905e authored by doctrine's avatar doctrine

[amadeus] changed exception name ($e) to not conflict with existing var of...

[amadeus] changed exception name ($e) to not conflict with existing var of that name. Also minor spelling error.
parent 50cced9e
...@@ -13,7 +13,7 @@ class Doctrine_RawSql extends Doctrine_Hydrate { ...@@ -13,7 +13,7 @@ class Doctrine_RawSql extends Doctrine_Hydrate {
* @return Doctrine_RawSql * @return Doctrine_RawSql
*/ */
public function __call($name, $args) { public function __call($name, $args) {
if( ! isset($this->parts[$name])) if( ! isset($this->parts[$name]))
throw new Doctrine_Exception("Unknown overload method"); throw new Doctrine_Exception("Unknown overload method");
if($name == 'select') { if($name == 'select') {
...@@ -21,7 +21,7 @@ class Doctrine_RawSql extends Doctrine_Hydrate { ...@@ -21,7 +21,7 @@ class Doctrine_RawSql extends Doctrine_Hydrate {
$this->fields = $m[1]; $this->fields = $m[1];
$this->parts["select"] = array(); $this->parts["select"] = array();
} else } else
$this->parts[$name][] = $args[0]; $this->parts[$name][] = $args[0];
return $this; return $this;
...@@ -34,7 +34,7 @@ class Doctrine_RawSql extends Doctrine_Hydrate { ...@@ -34,7 +34,7 @@ class Doctrine_RawSql extends Doctrine_Hydrate {
* @return Doctrine_RawSql * @return Doctrine_RawSql
*/ */
public function parseQuery($query) { public function parseQuery($query) {
preg_match_all('/{([^}{]*)}/U', $query, $m); preg_match_all('/{([^}{]*)}/U', $query, $m);
$this->fields = $m[1]; $this->fields = $m[1];
$this->clear(); $this->clear();
...@@ -76,8 +76,8 @@ class Doctrine_RawSql extends Doctrine_Hydrate { ...@@ -76,8 +76,8 @@ class Doctrine_RawSql extends Doctrine_Hydrate {
} }
/** /**
* getQuery * getQuery
* *
* *
* @return string * @return string
*/ */
public function getQuery() { public function getQuery() {
...@@ -87,12 +87,12 @@ class Doctrine_RawSql extends Doctrine_Hydrate { ...@@ -87,12 +87,12 @@ class Doctrine_RawSql extends Doctrine_Hydrate {
$e = explode(".", $field); $e = explode(".", $field);
if( ! isset($e[1])) if( ! isset($e[1]))
throw new Doctrine_Exception("All selected fields in Sql query must be in format tableAlias.fieldName"); throw new Doctrine_Exception("All selected fields in Sql query must be in format tableAlias.fieldName");
if( ! isset($this->tables[$e[0]])) { if( ! isset($this->tables[$e[0]])) {
try { try {
$this->addComponent($e[0], ucwords($e[0])); $this->addComponent($e[0], ucwords($e[0]));
} catch(Doctrine_Exception $e) { } catch(Doctrine_Exception $exception) {
throw new Doctrine_Exception("The associated component for tablealias $e[0] couldn't be found."); throw new Doctrine_Exception("The associated component for table alias $e[0] couldn't be found.");
} }
} }
...@@ -106,7 +106,7 @@ class Doctrine_RawSql extends Doctrine_Hydrate { ...@@ -106,7 +106,7 @@ class Doctrine_RawSql extends Doctrine_Hydrate {
$this->parts["select"][$field] = $field." AS ".$e[0]."__".$e[1]; $this->parts["select"][$field] = $field." AS ".$e[0]."__".$e[1];
} }
} }
// force-add all primary key fields // force-add all primary key fields
foreach($this->tableAliases as $alias) { foreach($this->tableAliases as $alias) {
...@@ -118,7 +118,7 @@ class Doctrine_RawSql extends Doctrine_Hydrate { ...@@ -118,7 +118,7 @@ class Doctrine_RawSql extends Doctrine_Hydrate {
} }
$q[] = "SELECT ".implode(', ', $this->parts['select']); $q[] = "SELECT ".implode(', ', $this->parts['select']);
$string = $this->applyInheritance(); $string = $this->applyInheritance();
if( ! empty($string)) if( ! empty($string))
$this->parts["where"][] = $string; $this->parts["where"][] = $string;
...@@ -150,12 +150,12 @@ class Doctrine_RawSql extends Doctrine_Hydrate { ...@@ -150,12 +150,12 @@ class Doctrine_RawSql extends Doctrine_Hydrate {
*/ */
public function addComponent($tableAlias, $componentName) { public function addComponent($tableAlias, $componentName) {
$e = explode(".", $componentName); $e = explode(".", $componentName);
$currPath = ''; $currPath = '';
foreach($e as $k => $component) { foreach($e as $k => $component) {
$currPath .= '.'.$component; $currPath .= '.'.$component;
if($k == 0) if($k == 0)
$currPath = substr($currPath,1); $currPath = substr($currPath,1);
if(isset($this->tableAliases[$currPath])) if(isset($this->tableAliases[$currPath]))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment