Sulu\Component\Rest\Listing\ListRestHelper::getFields PHP Method

getFields() public method

If null is returned every field should be contained.
public getFields ( ) : array | null
return array | null
    public function getFields()
    {
        $fields = $this->getRequest()->get('fields');
        return $fields != null ? explode(',', $fields) : null;
    }

Usage Example

Example #1
0
 public function testGetFields()
 {
     $request = new Request(['fields' => 'field1,field2,field3', 'sortBy' => 'id', 'sortOrder' => 'desc', 'search' => 'test', 'searchFields' => 'title', 'limit' => 10, 'page' => 3]);
     $helper = new ListRestHelper($request, $this->em);
     $this->assertEquals(['field1', 'field2', 'field3'], $helper->getFields());
     $this->assertEquals(['id' => 'desc'], $helper->getSorting());
     $this->assertEquals('test', $helper->getSearchPattern());
     $this->assertEquals(['title'], $helper->getSearchFields());
     $this->assertEquals(10, $helper->getLimit());
     $this->assertEquals(20, $helper->getOffset());
 }
All Usage Examples Of Sulu\Component\Rest\Listing\ListRestHelper::getFields