Pimcore\Model\Metadata\Predefined::getById PHP Method

getById() public static method

public static getById ( integer $id ) : self
$id integer
return self
    public static function getById($id)
    {
        try {
            $metadata = new self();
            $metadata->setId($id);
            $metadata->getDao()->getById();
            return $metadata;
        } catch (\Exception $e) {
            return null;
        }
    }

Usage Example

Beispiel #1
0
 /**
  * Loads a list of predefined metadata definitions for the specicified parameters, returns an array of
  * Metadata\Predefined elements
  *
  * @return array
  */
 public function load()
 {
     $properties = [];
     $definitions = $this->db->fetchAll($this->model->getFilter(), $this->model->getOrder());
     foreach ($definitions as $propertyData) {
         $properties[] = Model\Metadata\Predefined::getById($propertyData["id"]);
     }
     $this->model->setDefinitions($properties);
     return $properties;
 }
All Usage Examples Of Pimcore\Model\Metadata\Predefined::getById