예제 #1
0
 public function testSetupObject()
 {
     $inheritance = new Inheritance();
     $inheritance->loadMapping(['key' => 'baz', 'extends' => 'BaseObject', 'class' => 'Foo\\Bar', 'package' => 'Foo']);
     $this->assertSame('Foo', $inheritance->getPackage());
     $this->assertSame('BaseObject', $inheritance->getAncestor());
     $this->assertSame('baz', $inheritance->getKey());
     $this->assertSame('Foo\\Bar', $inheritance->getClassName());
 }
예제 #2
0
 /**
  * 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);
 }
예제 #3
0
파일: Column.php 프로젝트: rouffj/Propel2
 /**
  * Adds a new inheritance definition to the inheritance list and set the
  * parent column of the inheritance to the current column
  * @param             mixed $inhdata Inheritance or XML data.
  */
 public function addInheritance($inhdata)
 {
     if ($inhdata instanceof Inheritance) {
         $inh = $inhdata;
         $inh->setColumn($this);
         if ($this->inheritanceList === null) {
             $this->inheritanceList = array();
             $this->isEnumeratedClasses = true;
         }
         $this->inheritanceList[] = $inh;
         return $inh;
     } else {
         $inh = new Inheritance();
         $inh->loadFromXML($inhdata);
         return $this->addInheritance($inh);
     }
 }
예제 #4
0
 /**
  * Appends the generated <inheritance> XML node to its parent node.
  *
  * @param Inheritance $inheritance The Inheritance model instance
  * @param \DOMNode    $parentNode  The parent DOMNode object
  */
 private function appendInheritanceNode(Inheritance $inheritance, \DOMNode $parentNode)
 {
     $inheritanceNode = $parentNode->appendChild($this->document->createElement('inheritance'));
     $inheritanceNode->setAttribute('key', $inheritance->getKey());
     $inheritanceNode->setAttribute('class', $inheritance->getClassName());
     if ($ancestor = $inheritance->getAncestor()) {
         $inheritanceNode->setAttribute('extends', $ancestor);
     }
 }
예제 #5
0
 /**
  * Overrides method to return child package, if specified.
  *
  * @return string
  */
 public function getPackage()
 {
     return $this->child->getPackage() ? $this->child->getPackage() : parent::getPackage();
 }