-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
EZP-31851: Added Twig helpers that abstracts content rendering #115
Conversation
Update: Investigating Travis issue right now. |
|
||
$request = new Request(); | ||
$request->attributes->add([ | ||
'_controller' => 'ez_content:viewAction', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This way of referencing controllers is deprecated, double colon ::
should be used instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 👍
eZ\Publish\Core\MVC\Symfony\Templating\RenderContentStrategy: | ||
arguments: | ||
$defaultMethod: 'inline' | ||
$renderMethods: !tagged_iterator ezplatform.render.method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to use tagged_locator
instead, since we will always look for a particular render method anyway (using the key)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to use
tagged_locator
instead, since we will always look for a particular render method anyway (using the key)?
Locators are not the best choice when it comes to both strict types && DDD. This is gonna still be a generic objects container with get
instead of something specifc. Until PHP has generics / STL support, the code is gonna usually cause a static analysis issue. Judging from this example alone...
I prefer to have an iterable
and an array property with "strict" @param \Foo\Bar[]
type. Since arrays itself are not strict, there's indeed not much of a difference. The difference is in DDD approach. My class should have no coupling on some ServiceLocator
coming from a framework.It's a domain & responsibility mixup and a poor choice by Symfony (IMHO). iterable
(or whatever more complex, but built-in type) seems to be cleaner.
eZ/Publish/Core/MVC/Symfony/Templating/Exception/InvalidResponseException.php
Outdated
Show resolved
Hide resolved
eZ/Publish/Core/MVC/Symfony/Templating/RenderMethod/RenderInline.php
Outdated
Show resolved
Hide resolved
eZ/Publish/Core/MVC/Symfony/Templating/Twig/Extension/RenderContentExtension.php
Outdated
Show resolved
Hide resolved
eZ/Publish/Core/MVC/Symfony/Templating/Twig/Extension/RenderExtension.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the existing tests are also failing.
Besides:
eZ\Publish\Core\MVC\Symfony\Templating\RenderContentStrategy: | ||
arguments: | ||
$defaultMethod: 'inline' | ||
$renderMethods: !tagged_iterator ezplatform.render.method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to use
tagged_locator
instead, since we will always look for a particular render method anyway (using the key)?
Locators are not the best choice when it comes to both strict types && DDD. This is gonna still be a generic objects container with get
instead of something specifc. Until PHP has generics / STL support, the code is gonna usually cause a static analysis issue. Judging from this example alone...
I prefer to have an iterable
and an array property with "strict" @param \Foo\Bar[]
type. Since arrays itself are not strict, there's indeed not much of a difference. The difference is in DDD approach. My class should have no coupling on some ServiceLocator
coming from a framework.It's a domain & responsibility mixup and a poor choice by Symfony (IMHO). iterable
(or whatever more complex, but built-in type) seems to be cleaner.
eZ/Publish/Core/MVC/Symfony/Templating/RenderMethod/RenderEdgeSideInclude.php
Outdated
Show resolved
Hide resolved
eZ/Publish/Core/MVC/Symfony/Templating/Twig/Extension/RenderContentExtension.php
Outdated
Show resolved
Hide resolved
eZ/Publish/Core/MVC/Symfony/Templating/Twig/Extension/RenderContentExtension.php
Outdated
Show resolved
Hide resolved
eZ/Publish/Core/MVC/Symfony/Templating/Twig/Extension/RenderExtension.php
Outdated
Show resolved
Hide resolved
Travis CI issue fixed. |
{ | ||
public function all(): array; | ||
|
||
public function get(string $key, $default = null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type hints for implicitly mixed param and return would be good here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 👍. Obsolete comment.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
a33cafc
to
587719e
Compare
* IBX-2823: Added loadRelation method https://issues.ibexa.co/browse/IBX-2823 * Update src/lib/Resources/settings/storage_engines/cache.yml Co-authored-by: Konrad Oboza <konrad.oboza@ez.no> * Update src/lib/Resources/settings/storage_engines/cache.yml Co-authored-by: Konrad Oboza <konrad.oboza@ez.no> * Fixed invalidate tags in removeRelation * Added tests * Update src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php Co-authored-by: Paweł Niedzielski <pawel.tadeusz.niedzielski@gmail.com> * Update tests/lib/Persistence/Legacy/Content/ContentHandlerTest.php Co-authored-by: Paweł Niedzielski <pawel.tadeusz.niedzielski@gmail.com> * Update tests/lib/Persistence/Legacy/Content/ContentHandlerTest.php Co-authored-by: Paweł Niedzielski <pawel.tadeusz.niedzielski@gmail.com> * Update tests/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabaseTest.php Co-authored-by: Paweł Niedzielski <pawel.tadeusz.niedzielski@gmail.com> * Update src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php Co-authored-by: Andrew Longosz <alongosz@users.noreply.github.com> * Update tests/lib/Persistence/Legacy/Content/ContentHandlerTest.php Co-authored-by: Andrew Longosz <alongosz@users.noreply.github.com> * Update tests/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabaseTest.php Co-authored-by: Andrew Longosz <alongosz@users.noreply.github.com> * Update src/lib/Persistence/Legacy/Content/Handler.php Co-authored-by: Andrew Longosz <alongosz@users.noreply.github.com> * Added deprecated info when destinationContentId is not passed * Fixed phpdoc for removeRelation method * Used const for relationId * Fixed cs * Update src/lib/Persistence/Cache/ContentHandler.php Co-authored-by: Andrew Longosz <alongosz@users.noreply.github.com> * Update src/lib/Persistence/Legacy/Content/Handler.php Co-authored-by: Andrew Longosz <alongosz@users.noreply.github.com> * Fixes after review * Fixed ContentHandlerTest::testLoadRelation Co-authored-by: Konrad Oboza <konrad.oboza@ez.no> Co-authored-by: Paweł Niedzielski <pawel.tadeusz.niedzielski@gmail.com> Co-authored-by: Andrew Longosz <alongosz@users.noreply.github.com>
v3.3
Still WIP (Todo section below), but open for brief review as main feature is done.
Based on a Proof of Concept/Experiment: ezsystems/ezpublish-kernel#1518
This PR provides two Twig helper functions and extensibility point for more:
ez_render_content
- abstracts Content rendering via different rendering methods (defaultinline
,subrequest
,esi
)ez_render_location
- abstracts Location rendering via different rendering methods (defaultinline
,subrequest
,esi
)ez_render
- provides strategy (that comes with abstraction for extensibility) for sub-renderers (like one used directly byez_render_content
orez_render_location
helper)Usage
Strategy used, default method:
{{ ez_render(content) }}
Direct renderer, default method:
{{ ez_render_content(content) }}
Direct renderer, subrequest method:
Todo:
(Optional) Strategy forLocation
object withez_render_location
as helper.Checklist:
$ composer fix-cs
).@ezsystems/php-dev-team
).