getId() 공개 메소드

public getId ( ) : integer
리턴 integer
예제 #1
0
파일: Href.php 프로젝트: sfie/pimcore
 /**
  * @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;
 }
예제 #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;
 }
예제 #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;
 }
예제 #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;
 }
예제 #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;
     }
 }
예제 #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());
     }
 }
예제 #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;
 }