本文整理汇总了PHP中Doctrine\Bundle\DoctrineBundle\Registry类的典型用法代码示例。如果您正苦于以下问题:PHP Registry类的具体用法?PHP Registry怎么用?PHP Registry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Registry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: __construct
public function __construct(Registry $doctrine, ReflectionService $reflectionService, AdvancedSearchFilter $advancedSearchFilter, IriConverter $iriConverter)
{
$this->em = $doctrine->getManager();
$this->reflectionService = $reflectionService;
$this->advancedSearchFilter = $advancedSearchFilter;
$this->iriConverter = $iriConverter;
}
开发者ID:partkeepr,项目名称:PartKeepr,代码行数:7,代码来源:ImporterService.php
示例5: __construct
/**
* @param \Doctrine\Bundle\DoctrineBundle\Registry $doctrine
*/
public function __construct($doctrine)
{
$dbConfig = $doctrine->getConnection()->getParams();
if (isset($dbConfig['dsn'])) {
$data = EhrlichAndreas_Util_Dsn::parseDsn($dbConfig['dsn']);
foreach ($data as $key => $value) {
$dbConfig[$key] = $value;
}
$data = EhrlichAndreas_Util_Dsn::parseUri($dbConfig['dsn']);
if (isset($data[0])) {
$dbConfig['adapter'] = ucfirst($data[0]);
}
if (isset($dbConfig['adapter']) && $dbConfig['driver']) {
$dbConfig['adapter'] = $dbConfig['driver'] . '_' . $dbConfig['adapter'];
}
}
if (!isset($dbConfig['adapter']) && isset($dbConfig['driver'])) {
$dbConfig['adapter'] = $dbConfig['driver'];
unset($dbConfig['driver']);
}
if (!isset($dbConfig['driver_options']) && isset($dbConfig['driverOptions'])) {
$dbConfig['driver_options'] = $dbConfig['driverOptions'];
unset($dbConfig['driverOptions']);
}
if (!isset($dbConfig['username']) && isset($dbConfig['user'])) {
$dbConfig['username'] = $dbConfig['user'];
unset($dbConfig['user']);
}
$this->adapter = EhrlichAndreas_Db_Db::factory($dbConfig);
$this->adapter->setConnection($doctrine->getConnection()->getWrappedConnection());
}
开发者ID:ehrlichandreas,项目名称:ehrlichandreas1-db,代码行数:34,代码来源:Adapter.php
示例6: __construct
/**
* @param \Doctrine\Bundle\DoctrineBundle\Registry $doctrine
* @param \Symfony\Bridge\Monolog\Logger $logger
*/
public function __construct(Doctrine $doctrine, Logger $logger)
{
$this->entityManager = $doctrine->getManager();
$dLogger = new \Doctrine\DBAL\Logging\DebugStack();
$doctrine->getConnection()->getConfiguration()->setSQLLogger($dLogger);
$logger->info(json_encode($dLogger->queries));
}
开发者ID:vimalkaurani,项目名称:healthByte,代码行数:11,代码来源:Helper.php
示例7: __construct
public function __construct(Registry $doctrine, Session $session, Logger $logger, Parameters $parameters)
{
$this->doctrine = $doctrine;
$this->session = $session;
$this->logger = $logger;
$this->parameters = $parameters;
$this->emFrom = $this->doctrine->getManager($this->parameters->getManagerFrom());
$this->emTo = $this->doctrine->getManager($this->parameters->getManagerTo());
$fromRetriever = new PgRetriever($doctrine, $this->logger, $this->parameters->getManagerFrom());
$fromRetriever->setIndexType(PgRetriever::INDEX_TYPE_NAME);
//$toRetriever = new PgRetriever($doctrine, $this->logger, $this->parameters->getManagerTo() );
//$toRetriever->setIndexType(PgRetriever::INDEX_TYPE_NAME);
$this->fromAnalyzer = new PgAnalyzer($this->logger, $fromRetriever);
//$this->toAnalyzer = new PgAnalyzer($this->logger, $toRetriever);
if ($this->session->has(CompareStructure::SESSION_FROM_KEY)) {
$this->fromAnalyzer->setSchemas($this->session->get(CompareStructure::SESSION_FROM_KEY));
$this->fromAnalyzer->initTables();
} else {
throw new SyncException('No source data');
}
/*if($this->session->has(CompareStructure::SESSION_TO_KEY)){
$this->toAnalyzer->setSchemas($this->session->get(CompareStructure::SESSION_TO_KEY));
$this->toAnalyzer->initTables();
}else{
throw new SyncException('No targeted data');
}*/
}
开发者ID:rombar3,项目名称:PgExplorer,代码行数:27,代码来源:SyncData.php
示例8: 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
示例9: 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
示例10: 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
示例11: 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
示例12: 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
示例13: 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
示例14: loadUserByUsername
public function loadUserByUsername($username)
{
if (!$username) {
return null;
}
return $this->_doctrine->getRepository('SiteBundle:User')->findOneBy(['username' => $username]);
}
开发者ID:pihterev,项目名称:plans,代码行数:7,代码来源:ApiKeyUserProvider.php
示例15: 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
示例16: 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
示例17: 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
示例18: __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
示例19: 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
示例20: getRights
/**
* Read available User/Host requirements from database
*
* @return array
*/
public function getRights()
{
/** @var UserHostRepository $repository */
$repository = $this->doctrine->getRepository($this->bundleName . ':UserHost');
$result = $repository->findAllSelect();
return $result;
}
开发者ID:homerjsimpson000,项目名称:CommandSchedulerBundle,代码行数:12,代码来源:RightsParser.php
注:本文中的Doctrine\Bundle\DoctrineBundle\Registry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论