Пример #1
0
 /**
  * Returns the entity
  * @param array $data
  * @return \Floxim\Floxim\Component\Basic\Entity
  */
 public function entity($data = array())
 {
     if (isset($data['id'])) {
         $cached = static::getFromStaticCache($data['id']);
         if ($cached) {
             return $cached;
         }
     }
     $classname = $this->getEntityClassName($data);
     if (isset($data['type'])) {
         $com = fx::getComponentByKeyword($data['type']);
         $component_id = $com['id'];
     } else {
         $component_id = $this->component_id;
     }
     $obj = new $classname(array('data' => $data, 'component_id' => $component_id));
     $this->addToStaticCache($obj);
     return $obj;
 }