Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Factory.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Bundle\EzPublishRestBundle\ApiLoader;
8
9 use eZ\Publish\Core\MVC\ConfigResolverInterface;
10 use eZ\Publish\Core\MVC\Symfony\RequestStackAware;
11 use eZ\Publish\Core\REST\Common\FieldTypeProcessor;
12 use eZ\Publish\API\Repository\Repository;
13 use Symfony\Component\Routing\RouterInterface;
14
15 class Factory
16 {
17 use RequestStackAware;
18
20 protected $configResolver;
21
23 protected $repository;
24
29 public function __construct(ConfigResolverInterface $configResolver, Repository $repository)
30 {
31 $this->configResolver = $configResolver;
32 $this->repository = $repository;
33 }
34
35 public function getBinaryFileFieldTypeProcessor()
36 {
37 $request = $this->getCurrentRequest();
38 $hostPrefix = isset($request) ? rtrim($request->getUriForPath('/'), '/') : '';
39
40 return new FieldTypeProcessor\BinaryProcessor(sys_get_temp_dir(), $hostPrefix);
41 }
42
43 public function getMediaFieldTypeProcessor()
44 {
45 return new FieldTypeProcessor\MediaProcessor(sys_get_temp_dir());
46 }
47
55 public function getImageFieldTypeProcessor(RouterInterface $router)
56 {
57 $variationsIdentifiers = array_keys($this->configResolver->getParameter('image_variations'));
58 sort($variationsIdentifiers);
59
60 return new FieldTypeProcessor\ImageProcessor(
61 // Config for local temp dir
62 // @todo get configuration
63 sys_get_temp_dir(),
64 // URL schema for image links
65 // @todo get configuration
66 $router,
67 // Image variations (names only)
68 $variationsIdentifiers
69 );
70 }
71 }
eZ\Bundle\EzPublishRestBundle\ApiLoader\Factory
Definition: Factory.php:16
eZ\Bundle\EzPublishRestBundle\ApiLoader\Factory\$configResolver
$configResolver
Definition: Factory.php:20
eZ\Bundle\EzPublishRestBundle\ApiLoader\Factory\__construct
__construct(ConfigResolverInterface $configResolver, Repository $repository)
Definition: Factory.php:29
eZ\Bundle\EzPublishRestBundle\ApiLoader\Factory\getBinaryFileFieldTypeProcessor
getBinaryFileFieldTypeProcessor()
Definition: Factory.php:35
eZ\Bundle\EzPublishRestBundle\ApiLoader\Factory\getImageFieldTypeProcessor
getImageFieldTypeProcessor(RouterInterface $router)
Factory for ezpublish_rest.field_type_processor.ezimage.
Definition: Factory.php:55
eZ\Bundle\EzPublishRestBundle\ApiLoader\Factory\$repository
$repository
Definition: Factory.php:23
eZ\Bundle\EzPublishRestBundle\ApiLoader\Factory\getMediaFieldTypeProcessor
getMediaFieldTypeProcessor()
Definition: Factory.php:43
eZ\Publish\API\Repository\Repository
Repository interface.
Definition: API/Repository/Repository.php:16
eZ\Publish\Core\MVC\ConfigResolverInterface
Interface for config resolvers.
Definition: ConfigResolverInterface.php:19
eZ\Bundle\EzPublishRestBundle\ApiLoader
Definition: Factory.php:7
eZ\Publish\Core\REST\Common\FieldTypeProcessor
Definition: AuthorProcessor.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.