Skip to content
Permalink
Browse files

EZP-26885: As a Developer I want to future proof my Field Types by us…

…ing Doctrine [in external storage] (#1993)

* EZP-26885: Implemented DoctrineStorage for Keyword FT

* EZP-26885: Implemented DoctrineStorage for Url FT

* EZP-26885: Implemented DoctrineStorage for RichText FT

* EZP-26885: Implemented DoctrineStorage for User FT

* [PHPUnit] Added base class for core FT integration tests

* EZP-26885: Added User FT storage GW tests

* EZP-26885: Implemented DoctrineStorage for Page FT

* EZP-26885: Implemented DoctrineStorage for MapLocation FT

* EZP-26885: Implemented DoctrineStorage for Image FT

* EZP-26885: Implemented DoctrineStorage for BinaryFile and Media FTs

* EZP-26885: Added deprecation doc and warnings to LegacyStorage Gateways
  • Loading branch information...
alongosz authored and andrerom committed Jul 3, 2017
1 parent bff024a commit d1143080d2325cadc6ccc1e3aee55b29aecebae4
Showing with 2,885 additions and 31 deletions.
  1. +414 −0 eZ/Publish/Core/FieldType/BinaryBase/BinaryBaseStorage/Gateway/DoctrineStorage.php
  2. +7 −0 eZ/Publish/Core/FieldType/BinaryBase/BinaryBaseStorage/Gateway/LegacyStorage.php
  3. +72 −0 eZ/Publish/Core/FieldType/BinaryFile/BinaryFileStorage/Gateway/DoctrineStorage.php
  4. +3 −0 eZ/Publish/Core/FieldType/BinaryFile/BinaryFileStorage/Gateway/LegacyStorage.php
  5. +318 −0 eZ/Publish/Core/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php
  6. +7 −0 eZ/Publish/Core/FieldType/Image/ImageStorage/Gateway/LegacyStorage.php
  7. +360 −0 eZ/Publish/Core/FieldType/Keyword/KeywordStorage/Gateway/DoctrineStorage.php
  8. +7 −0 eZ/Publish/Core/FieldType/Keyword/KeywordStorage/Gateway/LegacyStorage.php
  9. +244 −0 eZ/Publish/Core/FieldType/MapLocation/MapLocationStorage/Gateway/DoctrineStorage.php
  10. +7 −0 eZ/Publish/Core/FieldType/MapLocation/MapLocationStorage/Gateway/LegacyStorage.php
  11. +114 −0 eZ/Publish/Core/FieldType/Media/MediaStorage/Gateway/DoctrineStorage.php
  12. +3 −0 eZ/Publish/Core/FieldType/Media/MediaStorage/Gateway/LegacyStorage.php
  13. +304 −0 eZ/Publish/Core/FieldType/Page/PageStorage/Gateway/DoctrineStorage.php
  14. +7 −0 eZ/Publish/Core/FieldType/Page/PageStorage/Gateway/LegacyStorage.php
  15. +61 −0 eZ/Publish/Core/FieldType/RichText/RichTextStorage/Gateway/DoctrineStorage.php
  16. +7 −0 eZ/Publish/Core/FieldType/RichText/RichTextStorage/Gateway/LegacyStorage.php
  17. +53 −0 eZ/Publish/Core/FieldType/Tests/Integration/BaseCoreFieldTypeIntegrationTest.php
  18. +25 −0 eZ/Publish/Core/FieldType/Tests/Integration/User/UserStorage/Gateway/DoctrineStorageTest.php
  19. +25 −0 eZ/Publish/Core/FieldType/Tests/Integration/User/UserStorage/Gateway/LegacyStorageTest.php
  20. +70 −0 eZ/Publish/Core/FieldType/Tests/Integration/User/UserStorage/UserStorageGatewayTest.php
  21. +61 −0 eZ/Publish/Core/FieldType/Tests/RichText/Gateway/DoctrineStorageTest.php
  22. +193 −0 eZ/Publish/Core/FieldType/Tests/Url/Gateway/DoctrineStorageTest.php
  23. +233 −0 eZ/Publish/Core/FieldType/Url/UrlStorage/Gateway/DoctrineStorage.php
  24. +6 −0 eZ/Publish/Core/FieldType/Url/UrlStorage/Gateway/LegacyStorage.php
  25. +236 −0 eZ/Publish/Core/FieldType/User/UserStorage/Gateway/DoctrineStorage.php
  26. +7 −0 eZ/Publish/Core/FieldType/User/UserStorage/Gateway/LegacyStorage.php
  27. +18 −18 eZ/Publish/Core/settings/storage_engines/legacy/external_storage_gateways.yml
  28. +3 −3 eZ/Publish/SPI/Tests/FieldType/ImageIntegrationTest.php
  29. +3 −1 eZ/Publish/SPI/Tests/FieldType/KeywordIntegrationTest.php
  30. +2 −2 eZ/Publish/SPI/Tests/FieldType/MapLocationIntegrationTest.php
  31. +5 −5 eZ/Publish/SPI/Tests/FieldType/RichTextIntegrationTest.php
  32. +3 −1 eZ/Publish/SPI/Tests/FieldType/UrlIntegrationTest.php
  33. +3 −1 eZ/Publish/SPI/Tests/FieldType/UserIntegrationTest.php
  34. +3 −0 phpunit-integration-legacy.xml
  35. +1 −0 phpunit.xml

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -15,6 +15,9 @@
use eZ\Publish\Core\Persistence\Database\SelectQuery;
use eZ\Publish\Core\Persistence\Database\InsertQuery;
/**
* @deprecated since 6.11. Use {@see \eZ\Publish\Core\FieldType\BinaryBase\BinaryBaseStorage\Gateway\DoctrineStorage} instead.
*/
abstract class LegacyStorage extends Gateway
{
/**
@@ -24,6 +27,10 @@ abstract class LegacyStorage extends Gateway
public function __construct(DatabaseHandler $dbHandler)
{
@trigger_error(
sprintf('%s is deprecated, use %s instead', self::class, DoctrineStorage::class),
E_USER_DEPRECATED
);
$this->dbHandler = $dbHandler;
}
@@ -0,0 +1,72 @@
<?php
/**
* This file is part of the eZ Publish Kernel package.
*
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace eZ\Publish\Core\FieldType\BinaryFile\BinaryFileStorage\Gateway;
use Doctrine\DBAL\Query\QueryBuilder;
use eZ\Publish\SPI\Persistence\Content\VersionInfo;
use eZ\Publish\SPI\Persistence\Content\Field;
use eZ\Publish\Core\FieldType\BinaryBase\BinaryBaseStorage\Gateway\DoctrineStorage as BaseDoctrineStorage;
use PDO;
/**
* Binary File Field Type external storage DoctrineStorage gateway.
*/
class DoctrineStorage extends BaseDoctrineStorage
{
/**
* {@inheritdoc}
*/
protected function getStorageTable()
{
return 'ezbinaryfile';
}
/**
* {@inheritdoc}
*/
protected function getPropertyMapping()
{
$propertyMap = parent::getPropertyMapping();
$propertyMap['download_count'] = [
'name' => 'downloadCount',
'cast' => 'intval',
];
return $propertyMap;
}
/**
* {@inheritdoc}
*/
protected function setFetchColumns(QueryBuilder $queryBuilder, $fieldId, $versionNo)
{
parent::setFetchColumns($queryBuilder, $fieldId, $versionNo);
$queryBuilder->addSelect(
$this->connection->quoteIdentifier('download_count')
);
}
/**
* {@inheritdoc}
*/
protected function setInsertColumns(QueryBuilder $queryBuilder, VersionInfo $versionInfo, Field $field)
{
parent::setInsertColumns($queryBuilder, $versionInfo, $field);
$queryBuilder
->setValue('download_count', ':downloadCount')
->setParameter(
':downloadCount',
$field->value->externalData['downloadCount'],
PDO::PARAM_INT
)
;
}
}
@@ -14,6 +14,9 @@
use eZ\Publish\Core\Persistence\Database\SelectQuery;
use eZ\Publish\Core\Persistence\Database\InsertQuery;
/**
* @deprecated since 6.11. Use {@see \eZ\Publish\Core\FieldType\BinaryFile\BinaryFileStorage\Gateway\DoctrineStorage} instead.
*/
class LegacyStorage extends BaseLegacyStorage
{
/**
Oops, something went wrong.

0 comments on commit d114308

Please sign in to comment.
You can’t perform that action at this time.