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


PHP DoctrineBundle\Registry类代码示例

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


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

示例1: __construct

 /**
  * @param Registry      $manager,
  * @param RequestStack  $requestStack,
  * @param ObjectManager $persistence
  *
  * @InjectParams({
  *     "manager"        = @Inject("doctrine"),
  *     "requestStack"   = @Inject("request_stack"),
  *     "persistence"    = @Inject("claroline.persistence.object_manager")
  * })
  */
 public function __construct(Registry $manager, RequestStack $requestStack, ObjectManager $persistence)
 {
     $this->manager = $persistence;
     $this->request = $requestStack->getCurrentRequest();
     $this->content = $manager->getRepository('ClarolineCoreBundle:Content');
     $this->translations = $manager->getRepository('ClarolineCoreBundle:ContentTranslation');
 }
开发者ID:claroline,项目名称:distribution,代码行数:18,代码来源:ContentManager.php

示例2: __construct

 public function __construct(Registry $doctrine, ContainerInterface $container, VersionService $versionService, CronLoggerService $cronLoggerService)
 {
     $this->entityManager = $doctrine->getManager();
     $this->setContainer($container);
     $this->versionService = $versionService;
     $this->cronLoggerService = $cronLoggerService;
 }
开发者ID:fulcrum3d,项目名称:PartKeepr,代码行数:7,代码来源:SystemService.php

示例3: __construct

 /**
  * @param Registry $em
  * @param string $class
  */
 public function __construct(Registry $em, $class, Request $request)
 {
     $this->em = $em->getManagerForClass($class);
     $this->class = $class;
     $this->repository = $em->getRepository($class);
     $this->request = $request;
 }
开发者ID:profcab,项目名称:ilios,代码行数:11,代码来源:PublishEventManager.php

示例4: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->output = $output;
     $this->institutionMediaService = $this->getContainer()->get('services.institution.media');
     $this->fileSystem = $this->institutionMediaService->getFilesystem();
     $this->logoSizes = $this->institutionMediaService->getSizesByType(InstitutionMediaService::LOGO_TYPE_IMAGE);
     $this->featuredMediaSizes = $this->institutionMediaService->getSizesByType(InstitutionMediaService::FEATURED_TYPE_IMAGE);
     $this->gallerySizes = $this->institutionMediaService->getSizesByType(InstitutionMediaService::GALLERY_TYPE_IMAGE);
     // loop through all institutions
     $this->doctrine = $this->getContainer()->get('doctrine');
     $institutions = $this->doctrine->getRepository('InstitutionBundle:Institution')->findAll();
     foreach ($institutions as $_institution) {
         $this->output->writeln('Migrating images of institution #' . $_institution->getId());
         $this->output->write("    ");
         // migrate logo
         $this->migrateLogo($_institution);
         $this->output->write("    ");
         // migrate banner
         $this->migrateFeaturedMedia($_institution);
         $this->output->write("    ");
         // migrate gallery
         $this->migrateGallery($_institution);
         $this->output->write("    ");
         // migrate clinic logos
         foreach ($_institution->getInstitutionMedicalCenters() as $imc) {
             $this->migrateClinicLogo($imc);
             $this->output->write("    ");
         }
         $this->output->writeln('All Done.');
     }
     $this->output->writeln('END OF SCRIPT');
 }
开发者ID:TMBaay,项目名称:MEDTrip---Healthcareabroad,代码行数:32,代码来源:MigrateInstitutionImagesCommand.php

示例5: onSuccess

 /**
  * @param GridView $entity
  */
 protected function onSuccess(GridView $entity)
 {
     $this->fixFilters($entity);
     $om = $this->registry->getManagerForClass('OroDataGridBundle:GridView');
     $om->persist($entity);
     $om->flush();
 }
开发者ID:Maksold,项目名称:platform,代码行数:10,代码来源:GridViewApiHandler.php

示例6: getEntityManager

 /**
  * @return EntityManager
  */
 private function getEntityManager()
 {
     if (!$this->doctrine) {
         $this->doctrine = $this->container->get('doctrine');
     }
     return $this->doctrine->getManager($this->entityManagerName);
 }
开发者ID:mcfedr,项目名称:doctrine-delay-queue-driver-bundle,代码行数:10,代码来源:DoctrineDelayTrait.php

示例7: getAccessTokenWithCheckingExpiration

 /**
  * @param UserEmailOrigin $origin
  *
  * @return string
  */
 public function getAccessTokenWithCheckingExpiration(UserEmailOrigin $origin)
 {
     $expiresAt = $origin->getAccessTokenExpiresAt();
     $utcTimeZone = new \DateTimeZone('UTC');
     $now = new \DateTime('now', $utcTimeZone);
     $token = $origin->getAccessToken();
     //if token had been expired, the new one must be generated and saved to DB
     if ($now > $expiresAt && $this->configManager->get('oro_imap.enable_google_imap')) {
         $parameters = ['refresh_token' => $origin->getRefreshToken(), 'grant_type' => 'refresh_token'];
         $attemptNumber = 0;
         do {
             $attemptNumber++;
             $response = $this->doHttpRequest($parameters);
             if (!empty($response['access_token'])) {
                 $token = $response['access_token'];
                 $origin->setAccessToken($token);
                 $newExpireDate = new \DateTime('+' . $response['expires_in'] . ' seconds', $utcTimeZone);
                 $origin->setAccessTokenExpiresAt($newExpireDate);
                 $this->doctrine->getManager()->persist($origin);
                 $this->doctrine->getManager()->flush();
             }
         } while ($attemptNumber <= self::RETRY_TIMES && empty($response['access_token']));
     }
     return $token;
 }
开发者ID:snorchel,项目名称:platform,代码行数:30,代码来源:ImapEmailGoogleOauth2Manager.php

示例8: renderDay

 /**
  * @param $date
  * @param $item
  * @param $precision 
  * @param $route_new
  * @param $route_show 
  */
 public function renderDay($date, $item, $project, $precision, $route_new, $route_show)
 {
     $start = new \DateTime($date);
     $end = (new \DateTime($date))->modify('+1 day');
     $bookings = $this->doctrine->getRepository($this->entity)->createQueryBuilder('b')->select('b')->where('b.start <= :start and b.end >= :end')->orwhere('b.end >= :start and b.end <= :end')->orwhere('b.start >= :start and b.start <= :end')->andWhere('b.item = :item')->orderBy('b.start', 'ASC')->setParameters(array('start' => $start, 'end' => $end, 'item' => $item))->getQuery()->getResult();
     return $this->environment->render('SladBookingBundle:Calendar:day.html.twig', array('date' => new \DateTime($date), 'item' => $item, 'project' => $project, 'bookings' => $bookings, 'precision' => $precision, 'route_new' => $route_new, 'route_show' => $route_show));
 }
开发者ID:stephylee,项目名称:SladBookingBundle,代码行数:14,代码来源:CalendarExtension.php

示例9: process

 /**
  * @param LineItem $lineItem
  *
  * @return bool
  */
 public function process(LineItem $lineItem)
 {
     if (in_array($this->request->getMethod(), ['POST', 'PUT'], true)) {
         /** @var EntityManagerInterface $manager */
         $manager = $this->registry->getManagerForClass('OroB2BShoppingListBundle:LineItem');
         $manager->beginTransaction();
         // handle case for new shopping list creation
         $formName = $this->form->getName();
         $formData = $this->request->request->get($formName, []);
         if (empty($formData['shoppingList']) && !empty($formData['shoppingListLabel'])) {
             $shoppingList = $this->shoppingListManager->createCurrent($formData['shoppingListLabel']);
             $formData['shoppingList'] = $shoppingList->getId();
             $this->request->request->set($formName, $formData);
         }
         $this->form->submit($this->request);
         if ($this->form->isValid()) {
             /** @var LineItemRepository $lineItemRepository */
             $lineItemRepository = $manager->getRepository('OroB2BShoppingListBundle:LineItem');
             $existingLineItem = $lineItemRepository->findDuplicate($lineItem);
             if ($existingLineItem) {
                 $this->updateExistingLineItem($lineItem, $existingLineItem);
             } else {
                 $manager->persist($lineItem);
             }
             $manager->flush();
             $manager->commit();
             return true;
         } else {
             $manager->rollBack();
         }
     }
     return false;
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:38,代码来源:LineItemHandler.php

示例10: loadUserByUsername

 public function loadUserByUsername($username)
 {
     if (!$username) {
         return null;
     }
     return $this->_doctrine->getRepository('SiteBundle:User')->findOneBy(['username' => $username]);
 }
开发者ID:pihterev,项目名称:plans,代码行数:7,代码来源:ApiKeyUserProvider.php

示例11: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->doctrine = $this->getContainer()->get('doctrine');
     // get all cities
     $qb = $this->doctrine->getManager()->createQueryBuilder();
     $qb->select('ct')->from('HelperBundle:City', 'ct')->where('ct.geoCityId IS NOT NULL')->orderBy('ct.id', 'ASC');
     $cities = $qb->getQuery()->getResult();
     $connection = $this->doctrine->getConnection();
     foreach ($cities as $city) {
         $output->write('Updating data of old city #' . $city->getId());
         $sql = "SELECT cg_gct.* FROM `chromedia_global`.`geo_cities` cg_gct WHERE cg_gct.`id` = ?";
         $statement = $connection->prepare($sql);
         $statement->bindValue(1, $city->getGeoCityId());
         $statement->execute();
         $globalCityData = $statement->fetch();
         if ($globalCityData) {
             $updateSql = "UPDATE `cities` SET `id` = :geoCityId, `name` = :geoCityName, `slug` = :geoCitySlug WHERE `old_id` = :oldId";
             $updateStatement = $connection->prepare($updateSql);
             $updateStatement->bindValue('geoCityId', $globalCityData['id']);
             $updateStatement->bindValue('geoCityName', $globalCityData['name']);
             $updateStatement->bindValue('geoCitySlug', $globalCityData['slug']);
             $updateStatement->bindValue('oldId', $city->getOldId());
             $updateStatement->execute();
             $output->writeln(' OK');
         } else {
             $output->writeln(' Not found');
         }
     }
 }
开发者ID:TMBaay,项目名称:MEDTrip---Healthcareabroad,代码行数:29,代码来源:UpdateCitiesDataFromGlobalDataCommand.php

示例12: dispatch

 /**
  * Dispatch a covoit using database alerts.
  * Find matching alerts, create notifications and send them.
  *
  * @param Covoit $covoit
  */
 public function dispatch(Covoit $covoit)
 {
     /** @var EntityManager $em */
     $em = $this->doctrine->getManager();
     /*
      * We find all the alerts and try to match these objects with the covoit. However, as the number of result could
      * be big, we use some simple conditions to limit results : he startCity, the endCity and the price. Matching
      * date is difficult directly in SQL as the condition depends of which fields are filled.
      */
     /** @var CovoitAlert[] $alerts */
     $alerts = $em->createQueryBuilder()->select('a, s, e, u')->from('EtuModuleCovoitBundle:CovoitAlert', 'a')->leftJoin('a.startCity', 's')->leftJoin('a.endCity', 'e')->leftJoin('a.user', 'u')->where('a.startCity = :startCiy OR a.startCity IS NULL')->andWhere('a.endCity = :endCity OR a.endCity IS NULL')->andWhere('a.priceMax <= :price OR a.priceMax IS NULL')->setParameters(['startCiy' => $covoit->getStartCity()->getId(), 'endCity' => $covoit->getEndCity()->getId(), 'price' => $covoit->getPrice()])->getQuery()->getResult();
     // Notifications - Send only one notification per user, even if covoit match several alerts
     $notifications = [];
     foreach ($alerts as $alert) {
         if ($this->match($alert, $covoit)) {
             $notif = $this->createNotification($covoit);
             $notif->setEntityId($alert->getId());
             $notif->setAuthorId($covoit->getAuthor()->getId());
             $notifications[$alert->getUser()->getId()] = $notif;
         }
     }
     // Send the notifications
     foreach ($notifications as $notification) {
         $this->sender->send($notification);
     }
 }
开发者ID:ChrisdAutume,项目名称:EtuUTT,代码行数:32,代码来源:NotificationsDispatcher.php

示例13: unsubscribe

 /**
  * @param string $entityType
  * @param integer $entityId
  * @param User $user
  * @return bool
  */
 public function unsubscribe(User $user, $entityType, $entityId)
 {
     /** @var $em EntityManager */
     $em = $this->doctrine->getManager();
     $em->createQueryBuilder()->delete('EtuCoreBundle:Subscription', 's')->andWhere('s.entityId = :entityId')->andWhere('s.entityType = :entityType')->andWhere('s.user = :user')->setParameter('entityType', $entityType)->setParameter('entityId', $entityId)->setParameter('user', $user->getId())->getQuery()->execute();
     return true;
 }
开发者ID:ChrisdAutume,项目名称:EtuUTT,代码行数:13,代码来源:SubscriptionsManager.php

示例14: __construct

 public function __construct(ContainerInterface $container, UrlGeneratorInterface $router, SecurityContext $securityContext, Doctrine $doctrine)
 {
     $this->router = $router;
     $this->securityContext = $securityContext;
     $this->em = $doctrine->getManager();
     $this->container = $container;
 }
开发者ID:Jheengut,项目名称:linuxcounter.new,代码行数:7,代码来源:LoginListener.php

示例15: contentBlock

 /**
  * @param string $blockName
  * @param array  $options
  * @param string $default
  * @return string
  */
 public function contentBlock($blockName, $options = array(), $default = null)
 {
     $em = $this->doctrine->getManager();
     $repository = $em->getRepository('GlavwebContentBlockBundle:ContentBlock');
     $contentBlock = $repository->findOneByName($blockName);
     $tag = isset($options['tag']) ? $options['tag'] : 'div';
     $attr = isset($options['attr']) ? $options['attr'] : array();
     if (isset($options['class'])) {
         $attr['class'] = $options['class'];
     }
     if (isset($options['href'])) {
         $attr['href'] = $options['href'];
     }
     if (!$contentBlock) {
         $contentBlock = new ContentBlock();
         $contentBlock->setName($blockName);
         $contentBlock->setBody($default ? $default : $blockName);
         $em->persist($contentBlock);
         $em->flush();
     }
     $contentEditable = '';
     $dataBlockName = '';
     $isEditable = $this->request && $this->request->get('contenteditable') && $this->securityContext->isGranted('ROLE_ADMIN');
     if ($isEditable) {
         $contentEditable = ' contenteditable="true"';
         $dataBlockName = ' data-block-name="' . $blockName . '"';
         $attr['class'] = isset($attr['class']) ? $attr['class'] . ' js-content-block' : 'js-content-block';
     }
     $attrParts = array();
     foreach ($attr as $attrName => $value) {
         $attrParts[] = sprintf('%s="%s"', $attrName, $value);
     }
     return '<' . $tag . ' ' . implode(' ', $attrParts) . ' ' . $contentEditable . $dataBlockName . '>' . $contentBlock->getBody() . '</' . $tag . '>';
 }
开发者ID:glavweb,项目名称:GlavwebContentBlockBundle,代码行数:40,代码来源:ContentBlockExtension.php


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