setName() public method

Set the group name
public setName ( string $name ) : self
$name string The name of the group
return self
Beispiel #1
0
 /**
  * Get the resources associated with a specific group
  *
  * @param EventInterface $event The current event
  */
 public function getGroup(EventInterface $event)
 {
     $route = $event->getRequest()->getRoute();
     $groupName = $route->get('group');
     $adapter = $event->getAccessControl();
     if (!$adapter->groupExists($groupName)) {
         throw new ResourceException('Resource group not found', 404);
     }
     $resources = $adapter->getGroup($groupName);
     $model = new GroupModel();
     $model->setName($groupName);
     $model->setResources($resources);
     $response = $event->getResponse();
     $response->setModel($model);
 }
Beispiel #2
0
 /**
  * @covers Imbo\Model\Group::getData
  */
 public function testGetData()
 {
     $this->model->setName('name')->setResources(['image.get', 'image.head']);
     $this->assertSame(['name' => 'name', 'resources' => ['image.get', 'image.head']], $this->model->getData());
 }