예제 #1
0
 /**
  * Get or Create the parent ChildScore object of the current object
  *
  * @return    ChildScore The parent object
  */
 public function getParentOrCreate($con = null)
 {
     if ($this->isNew()) {
         if ($this->isPrimaryKeyNull()) {
             $parent = new ChildScore();
             $parent->setDescendantClass('iuf\\junia\\model\\PerformanceScore');
             return $parent;
         } else {
             $parent = \iuf\junia\model\ScoreQuery::create()->findPk($this->getPrimaryKey(), $con);
             if (null === $parent || null !== $parent->getDescendantClass()) {
                 $parent = new ChildScore();
                 $parent->setPrimaryKey($this->getPrimaryKey());
                 $parent->setDescendantClass('iuf\\junia\\model\\PerformanceScore');
             }
             return $parent;
         }
     } else {
         return ChildScoreQuery::create()->findPk($this->getPrimaryKey(), $con);
     }
 }