Esempio n. 1
0
 /**
  * @param  Object_Abstract $target
  * @param  Object_Abstract $source
  * @return Object_Abstract copied object
  */
 public function copyAsChild($target, $source)
 {
     //load properties
     $source->getProperties();
     //load all in case of lazy loading fields
     self::loadAllObjectFields($source);
     $new = clone $source;
     $new->o_id = null;
     $new->setChilds(null);
     $new->setKey(Element_Service::getSaveCopyName("object", $new->getKey(), $target));
     $new->setParentId($target->getId());
     $new->setUserOwner($this->_user->getId());
     $new->setUserModification($this->_user->getId());
     $new->setResource(null);
     $new->setLocked(false);
     $new->save();
     $this->updateChilds($target, $new);
     return $new;
 }
Esempio n. 2
0
 /**
  * @param  Asset $target
  * @param  Asset $source
  * @return Asset copied asset
  */
 public function copyAsChild($target, $source)
 {
     $source->getProperties();
     if (!$source instanceof Asset_Folder) {
         $source->getData();
     }
     $new = clone $source;
     $new->id = null;
     if ($new instanceof Asset_Folder) {
         $new->setChilds(null);
     }
     $new->setFilename(Element_Service::getSaveCopyName("asset", $new->getFilename(), $target));
     $new->setParentId($target->getId());
     $new->setUserOwner($this->_user->getId());
     $new->setUserModification($this->_user->getId());
     $new->setResource(null);
     $new->setLocked(false);
     $new->save();
     if ($target instanceof Asset_Folder) {
         $this->updateChilds($target, $new);
     }
     return $new;
 }
Esempio n. 3
0
 /**
  * @param  Document $target
  * @param  Document $source
  * @return Document copied document
  */
 public function copyAsChild($target, $source)
 {
     if ($source instanceof Document_Page || $source instanceof Document_Snippet) {
         $source->getElements();
     }
     $source->getProperties();
     $new = clone $source;
     $new->id = null;
     $new->setChilds(null);
     $new->setKey(Element_Service::getSaveCopyName("document", $new->getKey(), $target));
     $new->setParentId($target->getId());
     $new->setUserOwner($this->_user->getId());
     $new->setUserModification($this->_user->getId());
     $new->setResource(null);
     $new->setLocked(false);
     $new->save();
     $this->updateChilds($target, $new);
     return $new;
 }
Esempio n. 4
0
 /**
  * @param  Document $target
  * @param  Document $source
  * @return Document copied document
  */
 public function copyAsChild($target, $source)
 {
     if (method_exists($source, "getElements")) {
         $source->getElements();
     }
     $source->getProperties();
     $new = clone $source;
     $new->id = null;
     $new->setChilds(null);
     $new->setKey(Element_Service::getSaveCopyName("document", $new->getKey(), $target));
     $new->setParentId($target->getId());
     $new->setUserOwner($this->_user->getId());
     $new->setUserModification($this->_user->getId());
     $new->setResource(null);
     $new->setLocked(false);
     if (method_exists($new, "setPrettyUrl")) {
         $new->setPrettyUrl(null);
     }
     $new->save();
     $this->updateChilds($target, $new);
     return $new;
 }