예제 #1
0
 public function testCreateView()
 {
     $gridView = new GridView();
     $gridView->setName('name');
     $gridView->setFiltersData(['f' => 'fv']);
     $gridView->setSortersData(['s' => 'sv']);
     $gridView->setColumnsData(['name' => ['order' => 4]]);
     $expectedView = new View(null, ['f' => 'fv'], ['s' => 'sv'], GridView::TYPE_PRIVATE, ['name' => ['order' => 4]]);
     $expectedView->setLabel('name');
     static::assertEquals($expectedView, $gridView->createView());
 }
예제 #2
0
 /**
  * @param GridView $entity
  *
  * @return boolean
  */
 public function process(GridView $entity)
 {
     $entity->setFiltersData();
     $entity->setSortersData();
     $entity->setColumnsData();
     $this->form->setData($entity);
     if (in_array($this->request->getMethod(), ['POST', 'PUT'])) {
         $data = $this->request->request->all();
         unset($data['name']);
         if ($this->form->has('owner')) {
             $data['owner'] = $entity->getOwner();
         }
         $this->form->submit($data);
         if ($this->form->isValid()) {
             $this->onSuccess($entity);
             return true;
         }
     }
     return false;
 }