-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EZP-26885: As a Developer I want to future proof my Field Types by using Doctrine [in external storage] #1911
Closed
alongosz
wants to merge
8
commits into
ezsystems:master
from
alongosz:ezp-26885-v2-ft-doctrine-ext-storage
Closed
EZP-26885: As a Developer I want to future proof my Field Types by using Doctrine [in external storage] #1911
alongosz
wants to merge
8
commits into
ezsystems:master
from
alongosz:ezp-26885-v2-ft-doctrine-ext-storage
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b25e6bb
to
a364c6f
Compare
6 tasks
a364c6f
to
7e10bd1
Compare
Tool version : PHP CS Fixer 2.1.2 by Fabien Potencier and Dariusz Ruminski You are running php-cs-fixer with xdebug enabled. This has a major impact on runtime performance.
Loaded config default from "/jenkins/jenkins.std/jobs/PAPI-Pull-Request-code-sniffer/workspace/.php_cs".
Using cache file ".php_cs.cache".
SSSSSS.SSS.SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.SSSSSS.SSSSSSSSSSS.SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS..SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.SSSSSSSSSSSSSSSSSSSS.SSS.SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.SSSSSS.SSSSSSSSSSSSSSSSSSSSSS.SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS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SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.SSS.SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.SSSSSSS
Legend: ?-unknown, I-invalid file syntax, file ignored, S-Skipped, .-no changes, F-fixed, E-error
1) eZ/Publish/Core/FieldType/Url/UrlStorage/Gateway/DoctrineStorage.php (method_separation)
---------- begin diff ----------
--- Original
+++ New
@@ @@
}
+
/**
* Removes link to URL for $fieldId in $versionNo and cleans up possibly orphaned URLs.
*
* @param int|string $fieldId
* @param int $versionNo
*/
public function unlinkUrl($fieldId, $versionNo)
{
$deleteQuery = $this->connection->createQueryBuilder();
$deleteQuery->delete(
$this->connection->quoteIdentifier(self::URL_LINK_TABLE)
)->where(
$deleteQuery->expr()->andX(
$deleteQuery->expr()->in('contentobject_attribute_id', ':contentobject_attribute_id'),
$deleteQuery->expr()->in('contentobject_attribute_version', ':contentobject_attribute_version')
)
)
->setParameter(':contentobject_attribute_id', $fieldId, PDO::PARAM_INT)
->setParameter(':contentobject_attribute_version', $versionNo, PDO::PARAM_INT)
;
$deleteQuery->execute();
$this->deleteOrphanedUrls();
}
/**
* Deletes all orphaned URLs.
*
* @todo using two queries because zeta Database does not support joins in delete query.
* That could be avoided if the feature is implemented there.
*
* URL is orphaned if it is not linked to a content attribute through ezurl_object_link table.
*/
private function deleteOrphanedUrls()
{
$query = $this->connection->createQueryBuilder();
$query
->select('url.id')
->from($this->connection->quoteIdentifier(self::URL_TABLE), 'url')
->leftJoin('url', $this->connection->quoteIdentifier(self(...)
NOTICE : Report truncated to 5Kb
|
Closing in favor of #1985 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note: we actually use
eZ\Publish\Core\Persistence\Doctrine\DoctrineConnection
which extendsDoctrine\DBAL\Connection
.This approach makes
FieldHandler
andContentUpdater
determine proper persistence Storage Handler for the specific FieldType from theFieldTypeRegistry
. Relevant changes are presented in 12ab214.The difference between this PR and #1908 is that injecting proper persistence Storage Handler into
GatewayBasedStorage
for each FieldType is no longer required. Sample implementation forezurl
is shown in c176270.To avoid adding too much responsibility to objects,
StorageHandlerRegistry
is introduced (along with proper compiler pass) to store actual persistence Storage Handlers (objects implementing\eZ\Publish\SPI\Persistence\Content\StorageHandler
).FieldTypeRegistry
gets them "asking"StorageHandlerRegistry
for e.g.LegacyStorage
orDoctrineStorage
.Note: "Storage handler" refers both to e.g
eZ\Publish\Core\Persistence\Legacy\Content\StorageHandler
and also to implementations which are obtained by it (likeeZ\Publish\Core\FieldType\Url\UrlStorage
). In this description I added "persistence" keyword to distinguish the first one.TODO:
Doctrine\DBAL\Connection
witheZ\Publish\Core\Persistence\Doctrine\DoctrineConnection
to be able to reuse getting Db sequence name if needed and supported by DBMS.StorageHandlerRegistry
which can register persistence Storage Handlers (and registerLegacyStorage
to it).FieldHandler
andContentUpdater
to getStorageHandler
fromFieldTypeRegistry
.StorageRegistry
toeZ\Publish\Core\Persistence\Content\StorageRegistry
namespace to reflect it's more common.StorageHandlerRegistry
).