Sulu\Bundle\CategoryBundle\Category\CategoryManagerInterface::getApiObject PHP Method

getApiObject() public method

Returns an API-Object for a given category-entity. The API-Object wraps the entity and provides neat getters and setters.
public getApiObject ( Sulu\Bundle\CategoryBundle\Entity\CategoryInterface $category, string $locale ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface
$category Sulu\Bundle\CategoryBundle\Entity\CategoryInterface
$locale string
return Sulu\Bundle\CategoryBundle\Entity\CategoryInterface
    public function getApiObject($category, $locale);

Usage Example

Example #1
0
 public function testGetApiObject()
 {
     $entity = new CategoryEntity();
     $wrapper = $this->categoryManager->getApiObject($entity, 'en');
     $this->assertTrue($wrapper instanceof CategoryWrapper);
     $wrapper = $this->categoryManager->getApiObject(null, 'de');
     $this->assertEquals(null, $wrapper);
 }