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

[Ecommerce Framework] Migration which enables generateTypeDeclarations #76

Open
BlackbitDevs opened this issue Nov 26, 2021 · 7 comments

Comments

@BlackbitDevs
Copy link
Contributor

BlackbitDevs commented Nov 26, 2021

In pimcore/pimcore#8040 the interfaces for the data model classes of the Ecommerce Framework bundle were extended so that the getter methods require return type declarations, e.g.:
https://github.com/pimcore/pimcore/blob/5661134f4bb8841dba8f6aa458277df89e50622c/bundles/EcommerceFrameworkBundle/Model/AbstractFilterDefinition.php#L33

Sadly there never was a migration for this. Consequently Pimcore crashes when you had the Ecommerce framework classes installed in Pimcore 6 (where generateTypeDeclarations did not exist yet) and update to Pimcore X. It also does not matter if you are actually using the Ecommerce Framework data object classes because they are loaded anyway once they got created and so the system crashes on every request:
Declaration of Pimcore\Model\DataObject\FilterDefinition::getPageLimit() must be compatible with Pimcore\Bundle\EcommerceFrameworkBundle\Model\AbstractFilterDefinition::getPageLimit(): ?float
This means that without generateTypeDeclarations being enabled the ecommerce framework classes will not work.

Also if you accidentically uncheck the generateTypeDeclarations checkbox in the class definition of one of the Ecommerce framework classes the same will happen.

In both cases you will not be able to access the Pimcore backend anymore and instead have to manually edit the class definition files and set generateTypeDeclarations to true.

A migration which enables generateTypeDeclarations for the corresponding classes would solve at least the problem when updating from earlier Pimcore versions to Pimcore X. I do not know if we can solve the problem of unchecking the generateTypeDeclarations checkbox manually.

@dvesh3
Copy link
Contributor

dvesh3 commented Nov 26, 2021

@BlackbitNeueMedien In the upgrade notes, it is mentioned that you to activate the generateTypeDeclarations check for all Ecommerce classes for migrations. https://pimcore.com/docs/pimcore/current/Development_Documentation/Installation_and_Upgrade/Upgrade_Notes/index.html#page_Changes

And there are migrations already exists which regenerates the class definitions on upgrade to Pimcore X(https://github.com/NiklasBr/pimcore/blob/10.1/bundles/CoreBundle/Migrations/Version20210702102100.php), it is not enough?

@BlackbitDevs
Copy link
Contributor Author

@dvesh3 - it is always nice when things are documented, but isn't it even nicer when it just works? What speaks against a migration which enables generateTypeDeclarations for the Ecommerce classes? I would even create a PR, only wanted to check first if this had a chance to get accepted.

@brusch
Copy link
Member

brusch commented Nov 29, 2021

@BlackbitNeueMedien hmm, I'm just wondering ... can we really create a migration that adds type declarations without breaking existing code? So if some fixes the issue already manually I mean 🤔

@BlackbitDevs
Copy link
Contributor Author

BlackbitDevs commented Nov 29, 2021

@brusch I cannot follow you. How can someone have fixed this problem already manually if not by enabling generateTypeDeclarations?
The only alternative way how this could have een done is to keep generateTypeDeclarations disabled and then override the data object classes and add the return types to the getter methods there. But this then would also still work if we set up a migration which enables generateTypeDeclarations.

@dvesh3
Copy link
Contributor

dvesh3 commented Dec 1, 2021

@BlackbitNeueMedien we are ok with a migration that enables generateTypeDeclarations property for Ecommerce classes but remember it needs to re-generate these classes afterwards (and there are already migrations for Pimcore X that is doing the job).

@stale
Copy link

stale bot commented Mar 14, 2022

Thanks a lot for reporting the issue. The issue was not considered by us as "Priority" or "Backlog", so we're not gonna work on that anytime soon. In case this is a bug report, please create a pull request fixing the issue, we'll then review it as soon as possible. If you're interested in contributing a feature, please contact us first here before creating a pull request, we'll then decide whether we'd accept it or not. Thanks for your understanding.

@stale stale bot added the PR Welcome label Mar 14, 2022
@brusch brusch transferred this issue from pimcore/pimcore May 31, 2023
@dvesh3 dvesh3 added Backlog and removed PR Welcome labels May 31, 2023
@dvesh3 dvesh3 self-assigned this Jun 28, 2023
@dvesh3 dvesh3 removed their assignment Jul 11, 2023
Copy link

Thanks a lot for reporting the issue. We did not consider the issue as "Pimcore:Priority", "Pimcore:ToDo" or "Pimcore:Backlog", so we're not going to work on that anytime soon. Please create a pull request to fix the issue if this is a bug report. We'll then review it as quickly as possible. If you're interested in contributing a feature, please contact us first here before creating a pull request. We'll then decide whether we'd accept it or not. Thanks for your understanding.

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

No branches or pull requests

3 participants