Skip to content
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

Injected RichText Validator from DIC into RichText Converter #91

Merged
merged 8 commits into from
Apr 25, 2019

Conversation

SerheyDolgushev
Copy link
Contributor

@SerheyDolgushev SerheyDolgushev commented Apr 4, 2019

// maintainer update:
Injecting proper DIC service will result in implicit swapping of this Validator when RichText bundle is enabled (it replaced eZ\Publish\Core\FieldType\RichText).

Note: if we intend to somehow support this bundle still with 3.0, then we will have to bump requirements and inject proper service from the RichText bundle

@andrerom andrerom requested a review from vidarl April 4, 2019 19:52
Copy link
Member

@alongosz alongosz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is rather complicated, because this bundle is supposed to work with eZ Platform 1.13 and 2.x. RichText Bundle has been introduced in v2.4. I think we need to stick to old deprecated ezpublish.fieldType.ezrichtext.validator.docbook.

When RichText bundle is enabled, this service gets replaced by the RichText one anyway.

Alternatively we could release new major here which would support ezpublish-kernel:^7.4 and require additionally ezplatform-richtext. But that's up to @andrerom or @vidarl

Anyway, it's a very good idea to inject that, just the old service. Remarks:

public function __construct($apiRepository = null, LoggerInterface $logger = null)
{
public function __construct(
ValidatorInterface $validator = null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's safer to place new argument as a last one

@@ -64,17 +64,22 @@ class RichText implements Converter

/**
* RichText constructor.
* @param null $validator
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I see we omitted type-hinting, it should be rather null|<FQCN of an actual class>
The same goes for Repository, but this is our mistake 😅

@SerheyDolgushev
Copy link
Contributor Author

@alongosz please review

lib/FieldType/XmlText/Converter/RichText.php Outdated Show resolved Hide resolved
lib/FieldType/XmlText/Converter/RichText.php Outdated Show resolved Hide resolved
@alongosz alongosz changed the title Use RichText validator, instead of eZ\Publish\Core Injected RichText Validator from DIC into RichText Converter Apr 18, 2019
@SerheyDolgushev
Copy link
Contributor Author

@alongosz requested changes are implemented. Please review one more time.

Copy link
Member

@vidarl vidarl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lserwatka lserwatka merged commit 4e5222e into ezsystems:master Apr 25, 2019
Copy link
Contributor

@andrerom andrerom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on staying compatible,currently no plans on supporting 3.0 here so using deprecated service that works across supported versions is best approach for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants