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

Media/MediaStorage/Gateway/DoctrineStorage.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\FieldType\Media\MediaStorage\Gateway;
8
9 use Doctrine\DBAL\ParameterType;
10 use Doctrine\DBAL\Query\QueryBuilder;
11 use eZ\Publish\SPI\Persistence\Content\VersionInfo;
12 use eZ\Publish\SPI\Persistence\Content\Field;
13 use eZ\Publish\Core\FieldType\BinaryBase\BinaryBaseStorage\Gateway\DoctrineStorage as BaseDoctrineStorage;
14 use PDO;
15
19 class DoctrineStorage extends BaseDoctrineStorage
20 {
24 protected function getStorageTable()
25 {
26 return 'ezmedia';
27 }
28
32 protected function getPropertyMapping()
33 {
34 $propertyMap = parent::getPropertyMapping();
35 $propertyMap['has_controller'] = [
36 'name' => 'hasController',
37 'cast' => function ($val) {
38 return (bool)$val;
39 },
40 ];
41 $propertyMap['is_autoplay'] = [
42 'name' => 'autoplay',
43 'cast' => function ($val) {
44 return (bool)$val;
45 },
46 ];
47 $propertyMap['is_loop'] = [
48 'name' => 'loop',
49 'cast' => function ($val) {
50 return (bool)$val;
51 },
52 ];
53 $propertyMap['width'] = [
54 'name' => 'width',
55 'cast' => 'intval',
56 ];
57 $propertyMap['height'] = [
58 'name' => 'height',
59 'cast' => 'intval',
60 ];
61
62 return $propertyMap;
63 }
64
68 protected function setFetchColumns(QueryBuilder $queryBuilder, $fieldId, $versionNo)
69 {
70 parent::setFetchColumns($queryBuilder, $fieldId, $versionNo);
71
72 $queryBuilder->addSelect(
73 [
74 $this->connection->quoteIdentifier('has_controller'),
75 $this->connection->quoteIdentifier('is_autoplay'),
76 $this->connection->quoteIdentifier('is_loop'),
77 $this->connection->quoteIdentifier('width'),
78 $this->connection->quoteIdentifier('height'),
79 ]
80 );
81 }
82
86 protected function setInsertColumns(QueryBuilder $queryBuilder, VersionInfo $versionInfo, Field $field)
87 {
88 parent::setInsertColumns($queryBuilder, $versionInfo, $field);
89
90 $queryBuilder
91 ->setValue('controls', ':controls')
92 ->setValue('has_controller', ':hasController')
93 ->setValue('height', ':height')
94 ->setValue('is_autoplay', ':isAutoplay')
95 ->setValue('is_loop', ':isLoop')
96 ->setValue('pluginspage', ':pluginsPage')
97 ->setValue('quality', ':quality')
98 ->setValue('width', ':width')
99 ->setParameter(':controls', '')
100 ->setParameter(
101 ':hasController',
102 $field->value->externalData['hasController'],
103 PDO::PARAM_INT
104 )
105 ->setParameter(':height', $field->value->externalData['height'], PDO::PARAM_INT)
106 ->setParameter(':isAutoplay', $field->value->externalData['autoplay'], PDO::PARAM_INT)
107 ->setParameter(':isLoop', $field->value->externalData['loop'], PDO::PARAM_INT)
108 ->setParameter(':pluginsPage', '')
109 ->setParameter(':quality', 'high')
110 ->setParameter(':width', $field->value->externalData['width'], PDO::PARAM_INT)
111 ;
112 }
113
117 protected function setUpdateColumns(QueryBuilder $queryBuilder, VersionInfo $versionInfo, Field $field)
118 {
119 parent::setUpdateColumns($queryBuilder, $versionInfo, $field);
120
121 $queryBuilder
122 ->set('controls', ':controls')
123 ->set('has_controller', ':hasController')
124 ->set('height', ':height')
125 ->set('is_autoplay', ':isAutoplay')
126 ->set('is_loop', ':isLoop')
127 ->set('pluginspage', ':pluginsPage')
128 ->set('quality', ':quality')
129 ->set('width', ':width')
130 ->setParameter(':controls', '')
131 ->setParameter(
132 ':hasController',
133 $field->value->externalData['hasController'],
134 ParameterType::INTEGER
135 )
136 ->setParameter(':height', $field->value->externalData['height'], ParameterType::INTEGER)
137 ->setParameter(':isAutoplay', $field->value->externalData['autoplay'], ParameterType::INTEGER)
138 ->setParameter(':isLoop', $field->value->externalData['loop'], ParameterType::INTEGER)
139 ->setParameter(':pluginsPage', '')
140 ->setParameter(':quality', 'high')
141 ->setParameter(':width', $field->value->externalData['width'], ParameterType::INTEGER)
142 ;
143 }
144 }
eZ\Publish\Core\FieldType\BinaryBase\BinaryBaseStorage\Gateway\DoctrineStorage
Base class for binary files external storage DoctrineStorage gateways.
Definition: BinaryBase/BinaryBaseStorage/Gateway/DoctrineStorage.php:21
eZ\Publish\Core\FieldType\Media\MediaStorage\Gateway\DoctrineStorage
Media Field Type external storage DoctrineStorage gateway.
Definition: Media/MediaStorage/Gateway/DoctrineStorage.php:20
eZ\Publish\Core\FieldType\Media\MediaStorage\Gateway\DoctrineStorage\getStorageTable
getStorageTable()
{Return the table name to store data in.string}
Definition: Media/MediaStorage/Gateway/DoctrineStorage.php:24
eZ\Publish\Core\FieldType\Media\MediaStorage\Gateway\DoctrineStorage\getPropertyMapping
getPropertyMapping()
{Return a column to property mapping for the storage table.array}
Definition: Media/MediaStorage/Gateway/DoctrineStorage.php:32
eZ\Publish\Core\FieldType\Media\MediaStorage\Gateway\DoctrineStorage\setUpdateColumns
setUpdateColumns(QueryBuilder $queryBuilder, VersionInfo $versionInfo, Field $field)
{}
Definition: Media/MediaStorage/Gateway/DoctrineStorage.php:117
eZ\Publish\Core\FieldType\Media\MediaStorage\Gateway\DoctrineStorage\setInsertColumns
setInsertColumns(QueryBuilder $queryBuilder, VersionInfo $versionInfo, Field $field)
{Set the required insert columns to insert query builder.This method is intended to be overwritten by...
Definition: Media/MediaStorage/Gateway/DoctrineStorage.php:86
eZ\Publish\Core\FieldType\Media\MediaStorage\Gateway\DoctrineStorage\setFetchColumns
setFetchColumns(QueryBuilder $queryBuilder, $fieldId, $versionNo)
{Set columns to be fetched from the database.This method is intended to be overwritten by derived cla...
Definition: Media/MediaStorage/Gateway/DoctrineStorage.php:68
eZ\Publish\SPI\Persistence\Content\Field
Definition: SPI/Persistence/Content/Field.php:12
eZ\Publish\SPI\Persistence\Content\VersionInfo
This class holds version information data.
Definition: SPI/Persistence/Content/VersionInfo.php:15
eZ\Publish\Core\FieldType\Media\MediaStorage\Gateway
Definition: Media/MediaStorage/Gateway/DoctrineStorage.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.