Fixed indentation and other issues related to coding style
This commit is contained in:
parent
34cce3e0c8
commit
be9d359937
@ -1170,28 +1170,26 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
|||||||
*/
|
*/
|
||||||
public function getClassnameToReturn()
|
public function getClassnameToReturn()
|
||||||
{
|
{
|
||||||
if(!isset($this->options["subclasses"])){
|
if (!isset($this->options["subclasses"])) {
|
||||||
return $this->options['name'];
|
return $this->options['name'];
|
||||||
}
|
}
|
||||||
foreach($this->options["subclasses"] as $subclass){
|
foreach ($this->options["subclasses"] as $subclass) {
|
||||||
$table = $this->conn->getTable($subclass);
|
$table = $this->conn->getTable($subclass);
|
||||||
$inheritanceMap = $table->getOption("inheritanceMap");
|
$inheritanceMap = $table->getOption("inheritanceMap");
|
||||||
$nomatch = false;
|
$nomatch = false;
|
||||||
foreach($inheritanceMap as $key => $value){
|
foreach ($inheritanceMap as $key => $value) {
|
||||||
if(!isset($this->data[$key]) || $this->data[$key] != $value){
|
if (!isset($this->data[$key]) || $this->data[$key] != $value) {
|
||||||
$nomatch = true;
|
$nomatch = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!$nomatch){
|
if (!$nomatch) {
|
||||||
return $table->getComponentName();
|
return $table->getComponentName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->options['name'];
|
return $this->options['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id database row id
|
* @param $id database row id
|
||||||
* @throws Doctrine_Find_Exception
|
* @throws Doctrine_Find_Exception
|
||||||
|
@ -40,7 +40,7 @@ class Doctrine_ColumnAggregationInheritance_TestCase extends Doctrine_UnitTestCa
|
|||||||
parent::prepareData();
|
parent::prepareData();
|
||||||
//we create a test entity that is not a user and not a group
|
//we create a test entity that is not a user and not a group
|
||||||
$entity = new Entity();
|
$entity = new Entity();
|
||||||
$entity->name="Other Entity";
|
$entity->name='Other Entity';
|
||||||
$entity->type = 2;
|
$entity->type = 2;
|
||||||
$entity->save();
|
$entity->save();
|
||||||
$this->otherEntity = $entity;
|
$this->otherEntity = $entity;
|
||||||
@ -49,19 +49,18 @@ class Doctrine_ColumnAggregationInheritance_TestCase extends Doctrine_UnitTestCa
|
|||||||
public function testQueriedClassReturnedIfNoSubclassMatch()
|
public function testQueriedClassReturnedIfNoSubclassMatch()
|
||||||
{
|
{
|
||||||
$q = new Doctrine_Query();
|
$q = new Doctrine_Query();
|
||||||
$entityOther = $q->from("Entity")->where("id=?")->execute(array($this->otherEntity->id))->getFirst();
|
$entityOther = $q->from('Entity')->where('id=?')->execute(array($this->otherEntity->id))->getFirst();
|
||||||
$this->assertTrue($entityOther instanceOf Entity);
|
$this->assertTrue($entityOther instanceOf Entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubclassReturnedIfInheritanceMatches()
|
public function testSubclassReturnedIfInheritanceMatches()
|
||||||
{
|
{
|
||||||
$q = new Doctrine_Query();
|
$q = new Doctrine_Query();
|
||||||
$group = $q->from("Entity")->where("id=?")->execute(array(1))->getFirst();
|
$group = $q->from('Entity')->where('id=?')->execute(array(1))->getFirst();
|
||||||
$this->assertTrue($group instanceOf Group);
|
$this->assertTrue($group instanceOf Group);
|
||||||
|
|
||||||
$q = new Doctrine_Query();
|
$q = new Doctrine_Query();
|
||||||
$user = $q->from("Entity")->where("id=?")->execute(array(5))->getFirst();
|
$user = $q->from('Entity')->where('id=?')->execute(array(5))->getFirst();
|
||||||
$this->assertTrue($user instanceOf User);
|
$this->assertTrue($user instanceOf User);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user