当前位置: 首页>>代码示例>>PHP>>正文


PHP Utils\ServiceLink类代码示例

本文整理汇总了PHP中Oro\Bundle\EntityConfigBundle\DependencyInjection\Utils\ServiceLink的典型用法代码示例。如果您正苦于以下问题:PHP ServiceLink类的具体用法?PHP ServiceLink怎么用?PHP ServiceLink使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ServiceLink类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 /**
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function setUp()
 {
     $this->em = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock();
     $this->doctrineHelper = $this->getMockBuilder('Oro\\Bundle\\EntityBundle\\ORM\\DoctrineHelper')->disableOriginalConstructor()->getMock();
     $this->mailer = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Mailer\\DirectMailer')->disableOriginalConstructor()->getMock();
     $this->mailerTransport = $this->getMockBuilder('\\Swift_Transport_EsmtpTransport')->disableOriginalConstructor()->getMock();
     $this->mailer->expects($this->any())->method('getTransport')->will($this->returnValue($this->mailerTransport));
     $this->emailEntityBuilder = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Builder\\EmailEntityBuilder')->disableOriginalConstructor()->getMock();
     $this->emailOwnerProvider = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Entity\\Provider\\EmailOwnerProvider')->disableOriginalConstructor()->getMock();
     $this->dispatcher = $this->getMockBuilder('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface')->disableOriginalConstructor()->getMock();
     $this->emailActivityManager = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Entity\\Manager\\EmailActivityManager')->disableOriginalConstructor()->getMock();
     $this->securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->setMethods(['getLoggedUser', 'getOrganization'])->disableOriginalConstructor()->getMock();
     $this->userEmailOrigin = $this->getMockBuilder('Oro\\Bundle\\ImapBundle\\Entity\\UserEmailOrigin')->disableOriginalConstructor()->getMock();
     $this->userEmailOrigin->expects($this->any())->method('getSmtpHost')->will($this->returnValue('abc'));
     $this->userEmailOrigin->expects($this->any())->method('getSmtpPort')->will($this->returnValue(25));
     $this->securityFacadeLink = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\DependencyInjection\\Utils\\ServiceLink')->setMethods(['getService'])->disableOriginalConstructor()->getMock();
     $this->securityFacadeLink->expects($this->any())->method('getService')->will($this->returnValue($this->securityFacade));
     $this->securityFacade->expects($this->any())->method('getOrganization')->will($this->returnValue($this->getTestOrganization()));
     $this->doctrineHelper->expects($this->any())->method('getEntityManager')->with('OroEmailBundle:Email')->will($this->returnValue($this->em));
     $folder = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Entity\\EmailFolder')->disableOriginalConstructor()->getMock();
     $this->userEmailOrigin->expects($this->any())->method('getFolder')->with(FolderType::SENT)->will($this->returnValue($folder));
     $emailOriginRepo = $this->getMockBuilder('Doctrine\\ORM\\EntityRepository')->disableOriginalConstructor()->getMock();
     $emailOriginRepo->expects($this->any())->method('findOneBy')->with(['internalName' => InternalEmailOrigin::BAP])->will($this->returnValue($this->userEmailOrigin));
     $this->em->expects($this->any())->method('getRepository')->with('OroEmailBundle:InternalEmailOrigin')->will($this->returnValue($emailOriginRepo));
     $this->emailProcessor = new Processor($this->doctrineHelper, $this->mailer, new EmailAddressHelper(), $this->emailEntityBuilder, $this->emailOwnerProvider, $this->emailActivityManager, $this->securityFacadeLink, $this->dispatcher, new Mcrypt());
 }
开发者ID:Maksold,项目名称:platform,代码行数:29,代码来源:ProcessorTest.php

示例2: setUp

 protected function setUp()
 {
     $this->service = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\SecurityContext')->disableOriginalConstructor()->getMock();
     $this->securityContextLink = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\DependencyInjection\\Utils\\ServiceLink')->disableOriginalConstructor()->getMock();
     $this->securityContextLink->expects($this->any())->method('getService')->willReturn($this->service);
     $this->flashBag = $this->getMock('Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface');
     $this->userChecker = new UserChecker($this->securityContextLink, $this->flashBag);
 }
开发者ID:nmallare,项目名称:platform,代码行数:8,代码来源:UserCheckerTest.php

示例3: __construct

 /**
  * @param EmailAttachmentManager $attachmentManager
  * @param ConfigProvider $configProvider
  * @param EmailActivityListProvider $activityListProvider
  * @param ServiceLink $securityFacadeLink
  * @param ActivityListChainProvider $chainProvider
  * @param EntityManager $entityManager
  */
 public function __construct(EmailAttachmentManager $attachmentManager, ConfigProvider $configProvider, EmailActivityListProvider $activityListProvider, ServiceLink $securityFacadeLink, ActivityListChainProvider $chainProvider, EntityManager $entityManager)
 {
     $this->attachmentManager = $attachmentManager;
     $this->configProvider = $configProvider;
     $this->activityListProvider = $activityListProvider;
     $this->securityFacade = $securityFacadeLink->getService();
     $this->chainProvider = $chainProvider;
     $this->entityManager = $entityManager;
 }
开发者ID:ramunasd,项目名称:platform,代码行数:17,代码来源:EmailBodyAddListener.php

示例4: __construct

 /**
  * @param EntityManager $entityManager
  * @param TranslatorInterface $translator
  * @param SecurityContext $securityContext
  * @param ServiceLink $securityFacadeLink
  * @param EmailManager $emailManager
  */
 public function __construct(EntityManager $entityManager, TranslatorInterface $translator, SecurityContext $securityContext, ServiceLink $securityFacadeLink, EmailManager $emailManager)
 {
     $this->entityManager = $entityManager;
     $this->translator = $translator;
     $this->securityContext = $securityContext;
     $this->user = $this->securityContext->getToken()->getUser();
     $this->securityFacade = $securityFacadeLink->getService();
     $this->emailManager = $emailManager;
 }
开发者ID:ramunasd,项目名称:platform,代码行数:16,代码来源:MarkMassActionHandler.php

示例5: __construct

 /**
  * @param DoctrineHelper           $doctrineHelper
  * @param \Swift_Mailer            $mailer
  * @param EmailAddressHelper       $emailAddressHelper
  * @param EmailEntityBuilder       $emailEntityBuilder
  * @param EmailOwnerProvider       $emailOwnerProvider
  * @param EmailActivityManager     $emailActivityManager
  * @param ServiceLink              $serviceLink
  * @param EventDispatcherInterface $eventDispatcher
  */
 public function __construct(DoctrineHelper $doctrineHelper, \Swift_Mailer $mailer, EmailAddressHelper $emailAddressHelper, EmailEntityBuilder $emailEntityBuilder, EmailOwnerProvider $emailOwnerProvider, EmailActivityManager $emailActivityManager, ServiceLink $serviceLink, EventDispatcherInterface $eventDispatcher)
 {
     $this->doctrineHelper = $doctrineHelper;
     $this->mailer = $mailer;
     $this->emailAddressHelper = $emailAddressHelper;
     $this->emailEntityBuilder = $emailEntityBuilder;
     $this->emailOwnerProvider = $emailOwnerProvider;
     $this->emailActivityManager = $emailActivityManager;
     $this->securityFacade = $serviceLink->getService();
     $this->eventDispatcher = $eventDispatcher;
 }
开发者ID:nmallare,项目名称:platform,代码行数:21,代码来源:Processor.php

示例6: onFlush

 /**
  * {@inheritdoc}
  */
 public function onFlush(OnFlushEventArgs $event)
 {
     // check for logged user is for confidence that data changes comes from UI, not from sync process.
     if ($this->securityFacadeLink->getService()->hasLoggedUser()) {
         $em = $event->getEntityManager();
         $this->processUpdates($em);
         $this->processDeletesAndCollections($em);
         while (null !== ($magentoCustomer = array_pop($this->processIds))) {
             $this->schedulerServiceLink->getService()->schedule($magentoCustomer->getChannel(), 'customer', ['id' => $magentoCustomer->getId()], false);
         }
     }
 }
开发者ID:dairdr,项目名称:crm,代码行数:15,代码来源:ContactListener.php

示例7: loadClassMetadata

 /**
  * @param LoadClassMetadataEventArgs $event
  */
 public function loadClassMetadata(LoadClassMetadataEventArgs $event)
 {
     $classMetadata = $event->getClassMetadata();
     $className = $classMetadata->getName();
     /** @var ExtendMetadataBuilder $metadataBuilder */
     $metadataBuilder = $this->metadataBuilderServiceLink->getService();
     if ($metadataBuilder->supports($className)) {
         $classMetadataBuilder = new ClassMetadataBuilder($classMetadata);
         $metadataBuilder->build($classMetadataBuilder, $className);
         $event->getEntityManager()->getMetadataFactory()->setMetadataFor($className, $classMetadata);
     }
 }
开发者ID:xamin123,项目名称:platform,代码行数:15,代码来源:DoctrineListener.php

示例8: setUp

 public function setUp()
 {
     $this->configProvider = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider')->disableOriginalConstructor()->getMock();
     $this->emailAttachmentManager = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Manager\\EmailAttachmentManager')->disableOriginalConstructor()->getMock();
     $this->activityListProvider = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Provider\\EmailActivityListProvider')->disableOriginalConstructor()->getMock();
     $this->securityFacadeLink = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\DependencyInjection\\Utils\\ServiceLink')->disableOriginalConstructor()->getMock();
     $this->securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->disableOriginalConstructor()->getMock();
     $this->securityFacadeLink->expects($this->once())->method('getService')->willReturn($this->securityFacade);
     $this->chainProvider = $this->getMockBuilder('Oro\\Bundle\\ActivityListBundle\\Provider\\ActivityListChainProvider')->disableOriginalConstructor()->getMock();
     $this->entityManager = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock();
     $this->listener = new EmailBodyAddListener($this->emailAttachmentManager, $this->configProvider, $this->activityListProvider, $this->securityFacadeLink, $this->chainProvider, $this->entityManager);
 }
开发者ID:Maksold,项目名称:platform,代码行数:12,代码来源:EmailBodyAddListenerTest.php

示例9: onProcessAfter

 /**
  * @param StrategyEvent $event
  */
 public function onProcessAfter(StrategyEvent $event)
 {
     $entity = $event->getEntity();
     /** @var OwnershipMetadataProvider $metadataProvider */
     $metadataProvider = $this->metadataProviderLink->getService();
     $organizationField = $metadataProvider->getMetadata(ClassUtils::getClass($entity))->getGlobalOwnerFieldName();
     if (!$organizationField) {
         return;
     }
     /** @var SecurityFacade $securityFacade */
     $securityFacade = $this->securityFacadeLink->getService();
     /**
      * We should allow to set organization for entity only in case of console import.
      * If import process was executed from UI (grid's import), current organization for entities should be set.
      */
     $organization = $this->getPropertyAccessor()->getValue($entity, $organizationField);
     if ($organization && $securityFacade->getOrganization() && $organization->getId() == $securityFacade->getOrganizationId()) {
         return;
     }
     $organization = $securityFacade->getOrganization();
     if (!$organization) {
         $organization = $this->getDefaultOrganization();
     }
     if (!$organization) {
         return;
     }
     $this->getPropertyAccessor()->setValue($entity, $organizationField, $organization);
 }
开发者ID:Maksold,项目名称:platform,代码行数:31,代码来源:ImportStrategyListener.php

示例10: onClear

 /**
  * @param OnClearEventArgs $event
  */
 public function onClear(OnClearEventArgs $event)
 {
     /** @var SecurityContextInterface $securityContext */
     $securityContext = $this->securityContextLink->getService();
     $className = $event->getEntityClass();
     $token = $securityContext->getToken();
     if (!$token) {
         return;
     }
     $user = $token->getUser();
     if (is_object($user) && (!$className || $className == ClassUtils::getRealClass($user))) {
         $user = $this->refreshEntity($user);
         if ($user) {
             $token->setUser($user);
         } else {
             $securityContext->setToken(null);
             $token = null;
         }
     }
     if ($token && $token instanceof OrganizationContextTokenInterface) {
         $organization = $token->getOrganizationContext();
         if (is_object($organization) && (!$className || $className == ClassUtils::getRealClass($organization))) {
             /** @var Organization $organization */
             $organization = $this->refreshEntity($organization);
             if ($organization) {
                 $token->setOrganizationContext($organization);
             }
         }
     }
 }
开发者ID:northdakota,项目名称:platform,代码行数:33,代码来源:RefreshContextListener.php

示例11: getContext

 /**
  * Gets context this strategy is working in
  *
  * @throws \RuntimeException
  * @return PermissionGrantingStrategyContextInterface
  */
 protected function getContext()
 {
     if ($this->contextLink === null) {
         throw new \RuntimeException('The context link is not set.');
     }
     return $this->contextLink->getService();
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:13,代码来源:PermissionGrantingStrategy.php

示例12: preUpload

 /**
  * Update attachment entity before upload
  *
  * @param File $entity
  */
 public function preUpload(File $entity)
 {
     if ($entity->isEmptyFile()) {
         if ($this->filesystem->has($entity->getFilename())) {
             $this->filesystem->delete($entity->getFilename());
         }
         $entity->setFilename(null);
         $entity->setExtension(null);
         $entity->setOriginalFilename(null);
     }
     if ($entity->getFile() !== null && $entity->getFile()->isFile()) {
         $entity->setOwner($this->securityFacadeLink->getService()->getLoggedUser());
         $file = $entity->getFile();
         if ($entity->getFilename() !== null && $this->filesystem->has($entity->getFilename())) {
             $this->filesystem->delete($entity->getFilename());
         }
         $entity->setExtension($file->guessExtension());
         if ($file instanceof UploadedFile) {
             $entity->setOriginalFilename($file->getClientOriginalName());
             $entity->setMimeType($file->getClientMimeType());
             $entity->setFileSize($file->getClientSize());
         } else {
             $entity->setOriginalFilename($file->getFileName());
             $entity->setMimeType($file->getMimeType());
             $entity->setFileSize($file->getSize());
         }
         $entity->setFilename(uniqid() . '.' . $entity->getExtension());
         if ($this->filesystem->getAdapter() instanceof MetadataSupporter) {
             $this->filesystem->getAdapter()->setMetadata($entity->getFilename(), ['contentType' => $entity->getMimeType()]);
         }
     }
 }
开发者ID:xamin123,项目名称:platform,代码行数:37,代码来源:AttachmentManager.php

示例13: convertToExportFormat

 /**
  * {@inheritdoc}
  */
 public function convertToExportFormat(array $exportedRecord, $skipNullValues = true)
 {
     if ($this->context->getValue('columns')) {
         $columns = $this->context->getValue('columns');
     } elseif ($this->context->hasOption('gridName')) {
         $gridName = $this->context->getOption('gridName');
         $gridConfig = $this->gridManagerLink->getService()->getConfigurationForGrid($gridName);
         $columns = $gridConfig->offsetGet('columns');
     } else {
         throw new InvalidConfigurationException('Configuration of datagrid export processor must contain "gridName" or "columns" options.');
     }
     if ($this->context->hasOption('gridParameters')) {
         $gridParams = $this->context->getOption('gridParameters');
         if ($gridParams->has(ColumnsExtension::COLUMNS_PARAM)) {
             $columnsParams = $gridParams->get(ColumnsExtension::COLUMNS_PARAM);
             $columns = $this->columnsHelper->reorderColumns($columns, $columnsParams);
         }
     }
     $result = [];
     foreach ($columns as $columnName => $column) {
         if (isset($column['renderable']) && false === $column['renderable']) {
             continue;
         }
         $val = isset($exportedRecord[$columnName]) ? $exportedRecord[$columnName] : null;
         $val = $this->applyFrontendFormatting($val, $column);
         $result[$this->translator->trans($column['label'])] = $val;
     }
     return $result;
 }
开发者ID:sagikazarmark,项目名称:platform,代码行数:32,代码来源:DatagridDataConverter.php

示例14: getUser

 /**
  * @param EntityManager $entityManager
  *
  * @return UserInterface|null
  */
 protected function getUser(EntityManager $entityManager)
 {
     $user = $this->securityFacadeLink->getService()->getLoggedUser();
     if ($user && $entityManager->getUnitOfWork()->getEntityState($user) == UnitOfWork::STATE_DETACHED) {
         $user = $entityManager->find('OroUserBundle:User', $user->getId());
     }
     return $user;
 }
开发者ID:ramunasd,项目名称:platform,代码行数:13,代码来源:CommentLifecycleListener.php

示例15: isEnabled

 /**
  * {@inheritdoc}
  */
 public function isEnabled(Mailbox $mailbox = null)
 {
     if ($mailbox === null || null === ($organization = $mailbox->getOrganization())) {
         $organization = $this->securityLink->getService()->getOrganization();
     }
     $qb = $this->getChannelRepository()->createQueryBuilder('c');
     return (bool) $qb->select('COUNT(c.id)')->join('c.entities', 'e')->andWhere('e.name = :name')->andWhere('c.status = :status')->andWhere('c.owner = :owner')->setParameter('name', static::LEAD_CLASS)->setParameter('status', Channel::STATUS_ACTIVE)->setParameter('owner', $organization)->getQuery()->getSingleScalarResult();
 }
开发者ID:antrampa,项目名称:crm,代码行数:11,代码来源:LeadMailboxProcessProvider.php


注:本文中的Oro\Bundle\EntityConfigBundle\DependencyInjection\Utils\ServiceLink类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。