Nextras\Orm\Repository\IRepository::getEntityMetadata PHP 메소드

getEntityMetadata() 공개 메소드

Returns entity metadata.
public getEntityMetadata ( ) : EntityMetadata
리턴 Nextras\Orm\Entity\Reflection\EntityMetadata
    public function getEntityMetadata();

Usage Example

예제 #1
0
파일: Control.php 프로젝트: ytnuk/orm
 protected function createComponentGrid() : Ytnuk\Grid\Control
 {
     $grid = new Ytnuk\Grid\Control(function (Nextras\Orm\Entity\IEntity $entity = NULL) {
         if (!$entity) {
             $entityClass = $this->repository->getEntityMetadata()->getClassName();
             $entity = new $entityClass();
         }
         $form = $this->form->create($entity);
         $form->onSubmit[] = function () {
             $this->redirect('this');
         };
         return $form;
     }, function (array $order, array $filter) {
         return $this->repository->findBy($this->prepareValues($filter))->orderBy($this->prepareValues($order))->fetchPairs(current($this->repository->getEntityMetadata()->getPrimaryKey()));
     });
     return $grid->setLink(function ($entity) {
         return $entity ? $this->getPresenter()->link('Presenter:edit', [current($this->repository->getEntityMetadata()->getPrimaryKey()) => $entity->id]) : $this->getPresenter()->link('Presenter:add');
     })->filterInputs(['this']);
 }
All Usage Examples Of Nextras\Orm\Repository\IRepository::getEntityMetadata