Pimcore\Model\Staticroute::getById PHP Method

getById() public static method

public static getById ( integer $id ) : Staticroute
$id integer
return Staticroute
    public static function getById($id)
    {
        $cacheKey = "staticroute_" . $id;
        try {
            $route = \Zend_Registry::get($cacheKey);
            if (!$route) {
                throw new \Exception("Route in registry is null");
            }
        } catch (\Exception $e) {
            try {
                $route = new self();
                \Zend_Registry::set($cacheKey, $route);
                $route->setId(intval($id));
                $route->getDao()->getById();
            } catch (\Exception $e) {
                Logger::error($e);
                return null;
            }
        }
        return $route;
    }

Usage Example

Beispiel #1
0
 /**
  * Loads a list of static routes for the specicifies parameters, returns an array of Staticroute elements
  *
  * @return array
  */
 public function load()
 {
     $routesData = $this->db->fetchCol("SELECT id FROM staticroutes" . $this->getCondition() . $this->getOrder() . $this->getOffsetLimit(), $this->model->getConditionVariables());
     $routes = array();
     foreach ($routesData as $routeData) {
         $routes[] = Model\Staticroute::getById($routeData);
     }
     $this->model->setRoutes($routes);
     return $routes;
 }
All Usage Examples Of Pimcore\Model\Staticroute::getById