isotope / core

Core repository of Isotope eCommerce, an eCommerce extension for Contao Open Source CMS
https://isotopeecommerce.org
136 stars 107 forks source link

Get rid of TL_MODE constant usage (Adaption to Contao5 Step 004) #2495

Closed Ernestopheles closed 10 months ago

Ernestopheles commented 10 months ago

Next adaption towards Contao 5.

See useCases tested with cypress: tests Contao 4.13.31, Isotope 2.9 and PHP 8.1

Ernestopheles commented 10 months ago

Next adaption (004) towards Contao 5.

Replace the TL_MODE query with a Scopematcher check.

Added a Helper-class to enhance readability, maintenance, reusage and test.

See useCases tested with cypress: tests Contao 4.13.31, Isotope 2.9 and PHP 8.1

Ernestopheles commented 10 months ago

We can create more Helper classes. An advantage of having one class just for Scope matching is the easy readable use, we have "Scope::isBackend" instead of perhaps *Helper::isBackend" or "Helper::scopeIsBackend"

aschempp commented 10 months ago

Yes, but since all those helper functions somewhat belong together, I would prefer to group them. Similar to the Contao StringUtil class. Maybe we could have a \Isotope\CompatibilityHelper::isBackendScope() and \Isotope\CompatibilityHelper::getProjectDir()?

Ernestopheles commented 10 months ago

\Isotope\CompatibilityHelper::getProjectDir() ... coming later

Ernestopheles commented 10 months ago

Such conflicts seems to be inevitable. I usually create each PR based on branch 2.9. If one oder more PR are merged, this base is not valid any more for the remaining PR and might lead to conflicts as seen here. Instead of creating independent PR maybe its better to base a PR on the last one created before? But this means, the PR must be merged in this sequence. I do not think we really do want that. Not sure how to solve this. Hope its ok for you to resove this conflict (both use statements are wanted).

Ernestopheles commented 10 months ago

What a mess! I did my best to resolve the conflicts; donna know why Track.php got all these unneccessary changes now; used contao\easy-coding-standard the way Contao Core does and only activated namespace ordering; this worked fine in all files except Track.php, where there are more (unneccessary) changes. Also did namespace ordering in more files (I hope this is ok).

Ernestopheles commented 10 months ago

Please resolve this conflict

aschempp commented 10 months ago

Thank you @Ernestopheles