Ejemplo n.º 1
0
 /**
  * Fetch tags for the given entity
  *
  * @param object       $entity entity
  * @param User         $owner
  * @param bool         $all
  * @param Organization $organization
  *
  * @return Collection
  */
 protected function fetchTags($entity, $owner, $all = false, Organization $organization = null)
 {
     $repository = $this->getTagsRepository();
     $usedOrganization = $organization ?: $this->getOrganization();
     $elements = $repository->getTags(ClassUtils::getClass($entity), TaggableHelper::getEntityId($entity), $owner, $all, $usedOrganization);
     return new ArrayCollection($elements);
 }
Ejemplo n.º 2
0
 /**
  * Returns tags with taggings loaded by resource
  *
  * @param object       $resource
  * @param int|null     $createdBy
  * @param bool         $all
  * @param Organization $organization
  *
  * @return array
  *
  * @deprecated Use {@see getTags} instead
  */
 public function getTagging($resource, $createdBy = null, $all = false, Organization $organization = null)
 {
     $recordId = TaggableHelper::getEntityId($resource);
     return $this->getTags(ClassUtils::getClass($resource), $recordId, $createdBy, $all, $organization);
 }
Ejemplo n.º 3
0
 /**
  * @dataProvider getEntityIdDataProvider
  *
  * @param object $object
  * @param bool   $expectedId
  */
 public function testGetEntityId($object, $expectedId)
 {
     $this->assertEquals($expectedId, TaggableHelper::getEntityId($object));
 }
Ejemplo n.º 4
0
 /**
  * Sets the resource
  *
  * @param Taggable $resource Resource to set
  */
 public function setResource(Taggable $resource)
 {
     $this->entityName = ClassUtils::getClass($resource);
     $this->recordId = TaggableHelper::getEntityId($resource);
 }