/** * Get or Create the parent ChildPackage object of the current object * * @return ChildPackage The parent object */ public function getParentOrCreate($con = null) { if ($this->isNew()) { if ($this->isPrimaryKeyNull()) { $parent = new ChildPackage(); $parent->setDescendantClass('keeko\\core\\model\\Application'); return $parent; } else { $parent = \keeko\core\model\PackageQuery::create()->findPk($this->getPrimaryKey(), $con); if (null === $parent || null !== $parent->getDescendantClass()) { $parent = new ChildPackage(); $parent->setPrimaryKey($this->getPrimaryKey()); $parent->setDescendantClass('keeko\\core\\model\\Application'); } return $parent; } } else { return ChildPackageQuery::create()->findPk($this->getPrimaryKey(), $con); } }