Пример #1
0
 /**
  * init
  *
  * @return self
  */
 public function init()
 {
     $table = Table::getInstance();
     $adapter = new SelectSource();
     $adapter->setSource($table->advancedSelect());
     $this->setAdapter($adapter);
     $this->setDefaultLimit(25);
     $this->setAllowOrders(['title', 'id', 'cost', 'categoryId']);
     $this->setAllowFilters(['title', 'description', 'categoryId', 'id']);
     return $this;
 }
Пример #2
0
<?php

namespace Application;

use Bluz\Proxy\Messages;
use Bluz\Proxy\Request;
use Application\Menu;
use Bluz\Db\Exception\RelationNotFoundException;
use Bluz\Proxy\Layout;
use Bluz\Proxy\Session;
return function ($dishId) use($view) {
    $dish = Menu\Table::findRow($dishId);
    if (Request::isGet()) {
        try {
            $view->unusedMedia = DishesMedia\Table::getUnusedMedia();
            //media for current dish
            $view->dishMedia = $dish->getRelations('Media');
        } catch (RelationNotFoundException $e) {
            $view->dishMedia = array();
        }
    }
};