Novactive / NovaeZSEOBundle

Novactive eZ Publish and Platform SEO Bundle
MIT License
25 stars 57 forks source link

Exception is thrown when getting image variation for metas #83

Closed homarx closed 5 years ago

homarx commented 6 years ago

I'm using NovaeZSEOBundle 2.1.1 with eZ 6.13.4.

In dev environment I get the following error when requesting a website: An exception has been thrown during the rendering of a template ("Notice: Trying to get property 'id' of non-object") in "NovaeZSEOBundle:fields:novaseometas.html.twig".

In getVariation function (MetaNameSchema.php) the variation is fetched with "new VersionInfo()" as version info parameter. In getCacheKey function of AliasGeneratorDecorator class this leads to an error, as $versionInfo->getContentInfo()->id is called.

As solution a class variable could be added in constructor of MetaNameSchema ($this->versionInfo) which is then set in resolveMeta function ($this->versionInfo = $content->getVersionInfo();) and could be used in getVariation function.

What do you think?

Plopix commented 6 years ago

Hello, Thanks for reporting. You are talking about that right: https://github.com/Novactive/NovaeZSEOBundle/blob/master/Core/MetaNameSchema.php#L285

Indeed, we need the VersionInfo related to the Content linked with the Image\Value ... I think back then we were not able to get it...

What I don't get is that we don't have the issue with the recent version of eZ using this bundle.

=> But that does not invalidate this issue (theoretically)

I don't think your solution is working as versionInfo is related to the Image Value of the Field and not something related the MetaNameSchema.. but I would need to look better into it. (I will)

++

Plopix commented 5 years ago

I'm closing for inactivity, feel free to reopen.