Sulu\Bundle\CategoryBundle\Api\Category::setMeta PHP Method

setMeta() public method

Takes meta as array and sets it to the entity.
public setMeta ( Sulu\Bundle\CategoryBundle\Entity\CategoryMetaInterface[] $metaEntities ) : Category
$metaEntities Sulu\Bundle\CategoryBundle\Entity\CategoryMetaInterface[]
return Category
    public function setMeta($metaEntities)
    {
        $currentMeta = $this->entity->getMeta();
        foreach ($metaEntities as $singleMeta) {
            $metaEntity = $this->getSingleMetaById($currentMeta, $singleMeta->getId());
            if (!$metaEntity) {
                $metaEntity = $singleMeta;
                $this->entity->addMeta($metaEntity);
            }
            $metaEntity->setCategory($this->entity);
            $metaEntity->setKey($singleMeta->getKey());
            $metaEntity->setValue($singleMeta->getValue());
            $metaEntity->setLocale($singleMeta->getLocale());
        }
        return $this;
    }