本文整理汇总了PHP中eZ\Publish\Core\MVC\ConfigResolverInterface类的典型用法代码示例。如果您正苦于以下问题:PHP ConfigResolverInterface类的具体用法?PHP ConfigResolverInterface怎么用?PHP ConfigResolverInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigResolverInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$this->ioServiceMock = $this->getMock('eZ\\Publish\\Core\\IO\\IOServiceInterface');
$this->configResolverMock = $this->getMock('eZ\\Publish\\Core\\MVC\\ConfigResolverInterface');
$this->configResolverMock->expects($this->any())->method('getParameter')->with('io.url_prefix')->will($this->returnValue($this->ioUriPrefix));
$this->eventListener = new StreamFileListener($this->ioServiceMock, $this->configResolverMock);
}
示例2: __construct
/**
* @param \eZ\Publish\Core\MVC\Symfony\Matcher\MatcherFactoryInterface $matcherFactory
* @param \eZ\Publish\Core\MVC\ConfigResolverInterface $configResolver
* @param \eZ\Publish\API\Repository\ContentService $contentService
* @param ProviderInterface[] Comments providers, indexed by their label.
* @param string|null $defaultProvider Label of provider to use by default. If not provided, the first entry in $providers will be used.
*/
public function __construct(MatcherFactoryInterface $matcherFactory, ConfigResolverInterface $configResolver, ContentService $contentService, array $providers = array(), $defaultProvider = null)
{
$this->matcherFactory = $matcherFactory;
$this->providers = $providers;
$this->setDefaultProviderLabel($defaultProvider ?: $configResolver->getParameter('default_provider', 'ez_comments'));
$this->contentService = $contentService;
}
示例3: __construct
public function __construct(EngineInterface $templateEngine, ConfigResolverInterface $configResolver, RequestStack $requestStack)
{
$this->templateEngine = $templateEngine;
$this->legacyLayout = $configResolver->getParameter('module_default_layout', 'ezpublish_legacy');
$this->legacyMode = $configResolver->getParameter('legacy_mode');
$this->requestStack = $requestStack;
}
示例4: setConfigResolver
/**
* Injects the ConfigResolver to potentially override default_target_path for redirections after authentication success.
*
* @param ConfigResolverInterface $configResolver
*/
public function setConfigResolver(ConfigResolverInterface $configResolver)
{
$defaultPage = $configResolver->getParameter('default_page');
if ($defaultPage !== null) {
$this->options['default_target_path'] = $defaultPage;
}
}
示例5: onKernelRequest
/**
* If user is logged-in in legacy_mode (e.g. legacy admin interface),
* will inject currently logged-in user in the repository.
*
* @param GetResponseEvent $event
*/
public function onKernelRequest(GetResponseEvent $event)
{
/** @var \eZ\Publish\Core\MVC\ConfigResolverInterface $configResolver */
$request = $event->getRequest();
$session = $request->getSession();
if ($event->getRequestType() !== HttpKernelInterface::MASTER_REQUEST || !$this->configResolver->getParameter('legacy_mode') || !($session->isStarted() && $session->has('eZUserLoggedInID'))) {
return;
}
try {
$apiUser = $this->repository->getUserService()->loadUser($session->get('eZUserLoggedInID'));
$this->repository->setCurrentUser($apiUser);
$token = $this->tokenStorage->getToken();
if ($token instanceof TokenInterface) {
$token->setUser(new User($apiUser));
// Don't embed if we already have a LegacyToken, to avoid nested session storage.
if (!$token instanceof LegacyToken) {
$this->tokenStorage->setToken(new LegacyToken($token));
}
}
} catch (NotFoundException $e) {
// Invalid user ID, the user may have been removed => invalidate the token and the session.
$this->tokenStorage->setToken(null);
$session->invalidate();
}
}
示例6: setUp
public function setUp()
{
$this->configResolver = $this->getMockBuilder('\\eZ\\Publish\\Core\\MVC\\ConfigResolverInterface')->getMock();
$this->configResolver->method('getParameter')->willReturn('Tests/fixtures/template_module.js');
$this->templating = $this->getMockBuilder('\\Symfony\\Component\\Templating\\EngineInterface')->getMock();
$this->templating->method('render')->willReturn('template');
$this->comboLoader = new ComboLoader($this->configResolver, $this->templating, '/yui/', 'Tests/fixtures');
}
示例7: buildService
/**
* Builds the page service.
*
* @param string $serviceClass the class of the page service
* @param ConfigResolverInterface $resolver
* @param \eZ\Publish\Core\FieldType\Page\PageStorage\Gateway $storageGateway
* @param \eZ\Publish\API\Repository\ContentService $contentService
*
* @return \eZ\Publish\Core\FieldType\Page\PageService
*/
public function buildService($serviceClass, ConfigResolverInterface $resolver, PageGateway $storageGateway, ContentService $contentService)
{
$pageSettings = $resolver->getParameter('ezpage');
/** @var $pageService \eZ\Publish\Core\FieldType\Page\PageService */
$pageService = new $serviceClass($contentService, $pageSettings['layouts'], $pageSettings['blocks']);
$pageService->setStorageGateway($storageGateway);
return $pageService;
}
示例8: __construct
public function __construct(\Closure $kernelClosure, ConfigResolverInterface $configResolver, URIHelper $uriHelper, LegacyResponseManager $legacyResponseManager, LegacyHelper $legacyHelper, RouterInterface $router)
{
$this->kernelClosure = $kernelClosure;
$this->legacyLayout = $configResolver->getParameter('module_default_layout', 'ezpublish_legacy');
$this->configResolver = $configResolver;
$this->uriHelper = $uriHelper;
$this->legacyResponseManager = $legacyResponseManager;
$this->legacyHelper = $legacyHelper;
$this->router = $router;
}
示例9: onSiteAccessMatch
public function onSiteAccessMatch(PostSiteAccessMatchEvent $event)
{
$rootLocationId = $this->configResolver->getParameter('content.tree_root.location_id');
$this->urlAliasRouter->setRootLocationId($rootLocationId);
$this->urlAliasGenerator->setRootLocationId($rootLocationId);
$this->urlAliasGenerator->setExcludedUriPrefixes($this->configResolver->getParameter('content.tree_root.excluded_uri_prefixes'));
}
示例10: getParameter
/**
* Returns the parameter value from config resolver.
*
* @param string $parameterName
* @param string $namespace
* @param mixed $defaultValue
*
* @return mixed
*/
protected function getParameter($parameterName, $namespace, $defaultValue = null)
{
if ($this->configResolver->hasParameter($parameterName, $namespace)) {
return $this->configResolver->getParameter($parameterName, $namespace);
}
return $defaultValue;
}
示例11: getContentDecorator
/**
* @param Location $location
* @return mixed
*/
public function getContentDecorator(Location $location)
{
$mappingEntities = $this->configResolver->getParameter('class_mapping', 'ezcontentdecorator');
$contentTypeIdentifier = $this->repository->getContentTypeService()->loadContentType($location->contentInfo->contentTypeId)->identifier;
$className = array_key_exists($contentTypeIdentifier, $mappingEntities) ? $mappingEntities[$contentTypeIdentifier] : $this->defaultClassName;
return new $className($this->container, $location, $contentTypeIdentifier);
}
示例12: matchRequest
/**
* Tries to match a request with a set of routes.
*
* If the matcher can not find information, it must throw one of the exceptions documented
* below.
*
* @param \Symfony\Component\HttpFoundation\Request $request The request to match
*
* @return array An array of parameters
*
* @throws \Symfony\Component\Routing\Exception\ResourceNotFoundException If no matching resource could be found
*/
public function matchRequest(Request $request)
{
if ($this->configResolver->getParameter('routing.enable_tag_router', 'eztags') === false) {
throw new ResourceNotFoundException('Config says to bypass TagRouter');
}
$requestedPath = rawurldecode($request->attributes->get('semanticPathinfo', $request->getPathInfo()));
$pathPrefix = $this->generator->getPathPrefix();
if (mb_stripos($requestedPath, $pathPrefix) !== 0) {
throw new ResourceNotFoundException();
}
$requestedPath = $this->removePathPrefix($requestedPath, $pathPrefix);
$requestedPath = trim($requestedPath, '/');
if (empty($requestedPath)) {
throw new ResourceNotFoundException();
}
$languages = $this->configResolver->getParameter('languages');
$tag = $this->tagsService->sudo(function (TagsService $tagsService) use($requestedPath, $languages) {
return $tagsService->loadTagByUrl($requestedPath, $languages);
});
// We specifically pass tag ID so tag view builder will reload the tag and check for permissions
// Unfortunately, since at this point user is still anonymous (why!?), this is the best we can do
$params = array('_route' => self::TAG_URL_ROUTE_NAME, '_controller' => static::TAG_VIEW_ACTION_CONTROLLER, 'tagId' => $tag->id);
$request->attributes->set('tagId', $tag->id);
if ($this->logger !== null) {
$this->logger->info("TagRouter matched tag #{$tag->id}. Forwarding to tag view controller");
}
return $params;
}
示例13: getParameter
public function getParameter($parameterName, $defaultValue = null)
{
if ($this->configResolver->hasParameter($parameterName)) {
return $this->configResolver->getParameter($parameterName);
}
return $defaultValue;
}
示例14: handle
public function handle(GetResponseEvent $event)
{
// In legacy_mode, "remember me" must be delegated to legacy kernel.
if ($this->configResolver->getParameter('legacy_mode')) {
return;
}
parent::handle($event);
}
示例15: buildRepository
/**
* Builds the main repository, heart of eZ Publish API
*
* This always returns the true inner Repository, please depend on ezpublish.api.repository and not this method
* directly to make sure you get an instance wrapped inside Signal / Cache / * functionality.
*
* @param \eZ\Publish\SPI\Persistence\Handler $persistenceHandler
*
* @return \eZ\Publish\API\Repository\Repository
*/
public function buildRepository(PersistenceHandler $persistenceHandler)
{
$repository = new $this->repositoryClass($persistenceHandler, array('fieldType' => $this->fieldTypeCollectionFactory->getFieldTypes(), 'role' => array('limitationTypes' => $this->roleLimitations), 'languages' => $this->configResolver->getParameter('languages')));
/** @var \eZ\Publish\API\Repository\Repository $repository */
$anonymousUser = $repository->getUserService()->loadUser($this->configResolver->getParameter("anonymous_user_id"));
$repository->setCurrentUser($anonymousUser);
return $repository;
}