コード例 #1
0
ファイル: CopyTagging.php プロジェクト: snorchel/platform
 /**
  * {@inheritdoc}
  */
 protected function executeAction($context)
 {
     $source = $this->getTaggable($context, static::PATH_SOURCE);
     $destination = $this->getTaggable($context, static::PATH_DESTINATION);
     $organization = $this->getOrganization($context);
     $this->tagManager->loadTagging($source, $organization);
     $tags = $this->tagManager->getTags($source);
     $this->tagManager->setTags($destination, $tags);
     $this->tagManager->saveTagging($destination, true, $organization);
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 protected function onSuccess($entity)
 {
     $targetEntity = $entity['target'];
     /** @var ArrayCollection $tags */
     $tags = $entity['tags'];
     $names = array_map(function ($tag) {
         return $tag['name'];
     }, $tags->getValues());
     $tags = $this->tagManager->loadOrCreateTags($names);
     $this->tagManager->setTags($targetEntity, new ArrayCollection($tags));
     $this->tagManager->saveTagging($targetEntity);
 }
コード例 #3
0
ファイル: MergeListener.php プロジェクト: Maksold/platform
 /**
  * Save tags
  *
  * @param EntityDataEvent $event
  */
 public function afterMergeEntity(EntityDataEvent $event)
 {
     $entityData = $event->getEntityData();
     $entityMetadata = $entityData->getMetadata();
     if (!$this->isTaggable($entityMetadata)) {
         return;
     }
     $masterEntity = $entityData->getMasterEntity();
     $masterTags = $this->tagManager->getTags($masterEntity)->getValues();
     $this->tagManager->setTags($masterEntity, ['all' => $masterTags, 'owner' => $masterTags]);
     $this->tagManager->saveTagging($masterEntity);
 }
コード例 #4
0
ファイル: LoadTagsData.php プロジェクト: mehulsbhatt/crm
 public function loadContactsTags()
 {
     $userTagsCount = count($this->tagsUser);
     $accountTagsCount = count($this->tagsAccount);
     foreach ($this->contactsRepository as $contact) {
         $this->tagManager->setTags($contact, new ArrayCollection([$this->tagsUser[rand(0, $userTagsCount - 1)], $this->tagsAccount[rand(0, $accountTagsCount - 1)]]));
         $this->tagManager->saveTagging($contact, false);
     }
     $this->flush($this->em);
 }
コード例 #5
0
ファイル: TagMergeAccessor.php プロジェクト: Maksold/platform
 /**
  * {@inheritdoc}
  */
 public function setValue($entity, FieldMetadata $metadata, $value)
 {
     $this->tagManager->setTags($entity, $value);
 }