コード例 #1
0
ファイル: InheritanceTest.php プロジェクト: disider/Propel2
 public function testCreateNewInheritance()
 {
     $column = $this->getMockBuilder('Propel\\Generator\\Model\\Column')->disableOriginalConstructor()->getMock();
     $inheritance = new Inheritance();
     $inheritance->setPackage('Foo');
     $inheritance->setAncestor('BaseObject');
     $inheritance->setKey('baz');
     $inheritance->setClassName('Foo\\Bar');
     $inheritance->setColumn($column);
     $this->assertInstanceOf('Propel\\Generator\\Model\\Column', $inheritance->getColumn());
     $this->assertSame('Foo', $inheritance->getPackage());
     $this->assertSame('BaseObject', $inheritance->getAncestor());
     $this->assertSame('baz', $inheritance->getKey());
     $this->assertSame('Foo\\Bar', $inheritance->getClassName());
 }
コード例 #2
0
ファイル: Column.php プロジェクト: bondarovich/Propel2
 /**
  * Adds a new inheritance definition to the inheritance list and sets the
  * parent column of the inheritance to the current column.
  *
  * @param  Inheritance|array $inheritance
  * @return Inheritance
  */
 public function addInheritance($inheritance)
 {
     if ($inheritance instanceof Inheritance) {
         $inheritance->setColumn($this);
         if (null === $this->inheritanceList) {
             $this->inheritanceList = [];
             $this->isEnumeratedClasses = true;
         }
         $this->inheritanceList[] = $inheritance;
         return $inheritance;
     }
     $inh = new Inheritance();
     $inh->loadMapping($inheritance);
     return $this->addInheritance($inh);
 }