getId() public method

public getId ( ) : integer
return integer
Exemplo n.º 1
0
 /**
  * @see Object\ClassDefinition\Data::getDataForEditmode
  * @param Asset|Document|Object\AbstractObject $data
  * @param null|Model\Object\AbstractObject $object
  * @return array
  */
 public function getDataForEditmode($data, $object = null)
 {
     if ($data instanceof Element\ElementInterface) {
         $r = array("id" => $data->getId(), "path" => $data->getFullPath(), "subtype" => $data->getType(), "type" => Element\Service::getElementType($data));
         return $r;
     }
     return;
 }
Exemplo n.º 2
0
 /**
  * Check if Object $object in array $objectList
  *
  * @param AbstractObject $object
  * @param array $objectList
  * @return bool
  */
 public static function objectInList(AbstractObject $object, array $objectList)
 {
     foreach ($objectList as $o) {
         if ($o->getId() == $object->getId()) {
             return true;
         }
     }
     return false;
 }
Exemplo n.º 3
0
 /**
  * @see Object\ClassDefinition\Data::getDataForEditmode
  * @param array $data
  * @param null|Model\Object\AbstractObject $object
  * @return array
  */
 public function getDataForEditmode($data, $object = null)
 {
     $return = array();
     if (is_array($data) && count($data) > 0) {
         foreach ($data as $object) {
             if ($object instanceof Object\Concrete) {
                 $return[] = array($object->getId(), $object->getFullPath(), $object->getClassName());
             }
         }
         if (empty($return)) {
             $return = false;
         }
         return $return;
     }
     return false;
 }
Exemplo n.º 4
0
 /**
  * @param self $o_parent
  * @return $this
  */
 public function setParent($o_parent)
 {
     $this->o_parent = $o_parent;
     if ($o_parent instanceof self) {
         $this->o_parentId = $o_parent->getId();
     }
     return $this;
 }
Exemplo n.º 5
0
 /**
  * @see Object\ClassDefinition\Data::getDataForResource
  * @param array $data
  * @param null|Model\Object\AbstractObject $object
  * @param mixed $params
  * @param mixed $params
  * @return array
  */
 public function getDataForResource($data, $object = null, $params = [])
 {
     $return = [];
     if (is_array($data) && count($data) > 0) {
         $counter = 1;
         foreach ($data as $object) {
             if ($object instanceof Element\ElementInterface) {
                 $return[] = ["dest_id" => $object->getId(), "type" => Element\Service::getElementType($object), "fieldname" => $this->getName(), "index" => $counter];
             }
             $counter++;
         }
         return $return;
     } elseif (is_array($data) and count($data) === 0) {
         //give empty array if data was not null
         return [];
     } else {
         //return null if data was null  - this indicates data was not loaded
         return null;
     }
 }
Exemplo n.º 6
0
 /**
  * @param Document|Asset|Object\AbstractObject $element
  * @return array
  */
 public static function getDependencyForFrontend($element)
 {
     if ($element instanceof ElementInterface) {
         return array("id" => $element->getId(), "path" => $element->getFullPath(), "type" => self::getElementType($element), "subtype" => $element->getType());
     }
 }
Exemplo n.º 7
0
 /**
  *
  * Checks if an object is an allowed relation
  * @param Model\Object\AbstractObject $object
  * @return boolean
  */
 protected function allowObjectRelation($object)
 {
     $allowedClasses = $this->getClasses();
     $allowed = true;
     if (!$this->getObjectsAllowed()) {
         $allowed = false;
     } else {
         if ($this->getObjectsAllowed() and is_array($allowedClasses) and count($allowedClasses) > 0) {
             //check for allowed classes
             if ($object instanceof Object\Concrete) {
                 $classname = $object->getClassName();
                 foreach ($allowedClasses as $c) {
                     $allowedClassnames[] = $c['classes'];
                 }
                 if (!in_array($classname, $allowedClassnames)) {
                     $allowed = false;
                 }
             } else {
                 $allowed = false;
             }
         } else {
             //don't check if no allowed classes set
         }
     }
     if ($object instanceof Object\AbstractObject) {
         \Logger::debug("checked object relation to target object [" . $object->getId() . "] in field [" . $this->getName() . "], allowed:" . $allowed);
     } else {
         \Logger::debug("checked object relation to target in field [" . $this->getName() . "], not allowed, target ist not an object");
         \Logger::debug($object);
     }
     return $allowed;
 }