コード例 #1
0
ファイル: TableControl.php プロジェクト: svobodni/web
 protected function createComponentTable()
 {
     $adminControl = new RouteItemsControl($this->commentRepository, $this->getExtendedPage());
     $admin = $adminControl->getTable();
     $table = $admin->getTable();
     $table->setModel(new Doctrine($this->commentRepository->createQueryBuilder('a')->andWhere('a.extendedPage = :page')->setParameter('page', $this->extendedPage->id)));
     $repository = $this->commentRepository;
     $entity = $this->extendedPage;
     $form = $admin->createForm($this->commentFormFactory, 'Comment', function () use($repository, $entity) {
         return $repository->createNew(array($entity));
     }, \CmsModule\Components\Table\Form::TYPE_FULL);
     $admin->connectFormWithAction($form, $table->getAction('edit'), $admin::MODE_PLACE);
     // Toolbar
     $toolbar = $admin->getNavbar();
     $toolbar->addSection('new', 'Create', 'file');
     $admin->connectFormWithNavbar($form, $toolbar->getSection('new'), $admin::MODE_PLACE);
     $table->addAction('delete', 'Delete')->getElementPrototype()->class[] = 'ajax';
     $admin->connectActionAsDelete($table->getAction('delete'));
     return $adminControl;
 }