コード例 #1
0
ファイル: BaseLanguage.php プロジェクト: rapila/cms-base
 /**
  * Sets contents of passed object to values from current object.
  *
  * If desired, this method can also make copies of all associated (fkey referrers)
  * objects.
  *
  * @param object $copyObj An object of Language (or compatible) type.
  * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
  * @throws PropelException
  */
 public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
 {
     $copyObj->setPathPrefix($this->getPathPrefix());
     $copyObj->setIsActive($this->getIsActive());
     $copyObj->setSort($this->getSort());
     $copyObj->setCreatedAt($this->getCreatedAt());
     $copyObj->setUpdatedAt($this->getUpdatedAt());
     $copyObj->setCreatedBy($this->getCreatedBy());
     $copyObj->setUpdatedBy($this->getUpdatedBy());
     if ($deepCopy && !$this->startCopy) {
         // important: temporarily setNew(false) because this affects the behavior of
         // the getter/setter methods for fkey referrer objects.
         $copyObj->setNew(false);
         // store object hash to prevent cycle
         $this->startCopy = true;
         foreach ($this->getPageStrings() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addPageString($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getLanguageObjects() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addLanguageObject($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getLanguageObjectHistorys() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addLanguageObjectHistory($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getTranslations() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addTranslation($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getUsersRelatedByLanguageId() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addUserRelatedByLanguageId($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getDocuments() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addDocument($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getLinks() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addLink($relObj->copy($deepCopy));
             }
         }
         //unflag object copy
         $this->startCopy = false;
     }
     // if ($deepCopy)
     if ($makeNew) {
         $copyObj->setNew(true);
         $copyObj->setId(NULL);
         // this is a auto-increment column, so set to default value
     }
 }
コード例 #2
0
ファイル: BaseContentObject.php プロジェクト: rapila/cms-base
 /**
  * Sets contents of passed object to values from current object.
  *
  * If desired, this method can also make copies of all associated (fkey referrers)
  * objects.
  *
  * @param object $copyObj An object of ContentObject (or compatible) type.
  * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
  * @throws PropelException
  */
 public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
 {
     $copyObj->setPageId($this->getPageId());
     $copyObj->setContainerName($this->getContainerName());
     $copyObj->setObjectType($this->getObjectType());
     $copyObj->setConditionSerialized($this->getConditionSerialized());
     $copyObj->setSort($this->getSort());
     $copyObj->setCreatedAt($this->getCreatedAt());
     $copyObj->setUpdatedAt($this->getUpdatedAt());
     $copyObj->setCreatedBy($this->getCreatedBy());
     $copyObj->setUpdatedBy($this->getUpdatedBy());
     if ($deepCopy && !$this->startCopy) {
         // important: temporarily setNew(false) because this affects the behavior of
         // the getter/setter methods for fkey referrer objects.
         $copyObj->setNew(false);
         // store object hash to prevent cycle
         $this->startCopy = true;
         foreach ($this->getLanguageObjects() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addLanguageObject($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getLanguageObjectHistorys() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addLanguageObjectHistory($relObj->copy($deepCopy));
             }
         }
         //unflag object copy
         $this->startCopy = false;
     }
     // if ($deepCopy)
     if ($makeNew) {
         $copyObj->setNew(true);
         $copyObj->setId(NULL);
         // this is a auto-increment column, so set to default value
     }
 }