Commit be9d3599 authored by meus's avatar meus

Fixed indentation and other issues related to coding style

parent 34cce3e0
......@@ -1170,28 +1170,26 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
*/
public function getClassnameToReturn()
{
if(!isset($this->options["subclasses"])){
if (!isset($this->options["subclasses"])) {
return $this->options['name'];
}
foreach($this->options["subclasses"] as $subclass){
foreach ($this->options["subclasses"] as $subclass) {
$table = $this->conn->getTable($subclass);
$inheritanceMap = $table->getOption("inheritanceMap");
$nomatch = false;
foreach($inheritanceMap as $key => $value){
if(!isset($this->data[$key]) || $this->data[$key] != $value){
foreach ($inheritanceMap as $key => $value) {
if (!isset($this->data[$key]) || $this->data[$key] != $value) {
$nomatch = true;
break;
}
}
if(!$nomatch){
if (!$nomatch) {
return $table->getComponentName();
}
}
return $this->options['name'];
}
/**
* @param $id database row id
* @throws Doctrine_Find_Exception
......
......@@ -40,7 +40,7 @@ class Doctrine_ColumnAggregationInheritance_TestCase extends Doctrine_UnitTestCa
parent::prepareData();
//we create a test entity that is not a user and not a group
$entity = new Entity();
$entity->name="Other Entity";
$entity->name='Other Entity';
$entity->type = 2;
$entity->save();
$this->otherEntity = $entity;
......@@ -49,19 +49,18 @@ class Doctrine_ColumnAggregationInheritance_TestCase extends Doctrine_UnitTestCa
public function testQueriedClassReturnedIfNoSubclassMatch()
{
$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);
}
public function testSubclassReturnedIfInheritanceMatches()
{
$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);
$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);
}
}
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