public function index()
    {
        $pagination = new Pagination();
        $pattern = StaticFilter::filter(
            'text',
            $this->getController()->request->getQuery('pattern', null)
        );
        $this->view = 'scaffold/index';
        $descriptor =  $this->getDescriptor();

        /** @var Select $query */
        $query = call_user_func_array([$this->getModelName(), 'find'], []);
        $field = $descriptor->getDisplayField();
        $tableName = $descriptor->getDescriptor()->getEntity()->getTableName();
        $query->where(
            [
                "{$tableName}.{$field} LIKE :pattern" => [
                    ':pattern' => "%{$pattern}%"
                ]
            ]
        );
        $pagination->setTotal($query->count());
        $query->limit(
            $pagination->rowsPerPage,
            $pagination->offset
        );
        $records = $query->all();
        $this->set(compact('pagination', 'records', 'pattern', 'descriptor'));
    }