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

hasInstance method is missing in the Kernel.php #93

Closed
wants to merge 18 commits into from
Closed

Conversation

fireflyfolio
Copy link

@fireflyfolio fireflyfolio commented May 29, 2017

Hello,

We're trying to migrate our former sites developed with eZ Publish 5.x in Legacy mode to eZ Platform 6.9.x with LegacyBridge 1.2.x.

I've noticed that the following folder has been moved from eZ Publish 5.x:
vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/MVC/Legacy
to
vendor/ezsystems/legacy-bridge/mvc

And the method hasInstance() has been removed from the class Kernel.php.

Could you give us the reason? Is it because it was used for Singleton Pattern which is considered now as an anti-pattern?

And is it possible to reintegrate it again?

The issue is that method is called in the following class:
vendor/ezsystems/legacy-bridge/bundle/Collector/TemplateDebugInfo.php

And other various classes as well.

Thank you in advance for your feedback.

Regards,

Quentin

Here is the method hasInstance extracted from eZ Publish 5.x :

/**
 * Checks if LegacyKernel has already been instantiated.
 *
 * @return bool
 */
public static function hasInstance()
{
    return static::$instance !== null;
}

emodric and others added 18 commits April 13, 2017 16:51
* Update PHP CS Fixer to v2

* Ran CS fixer
* Fix routerpass to use defined class

* Use FQCN as string, since legacy bridge still supports PHP 5.4.

* Simplify routing pass
* Add Option to use NotFoundHttpException for 404 HTTP errors

* Add Option to use NotFoundHttpException for 404 HTTP errors (Test)

* Add Option to use NotFoundHttpException for 404 HTTP errors (Add an E_USER_DEPRECATED if legacy handles the 404 error)
@lolautruche
Copy link
Contributor

Hi @quentinthai
I think you need to rebase your branch 😃

@fireflyfolio
Copy link
Author

fireflyfolio commented May 29, 2017

Hi @lolautruche
No problem. I've just selected the latest stable branch and put my PR in it... ^^

@lolautruche
Copy link
Contributor

I don't see your commit in the commits list

@lolautruche
Copy link
Contributor

@quentinthai This method has been removed in eb717c1 but should still work since Kernel extends ezpKernel (from ezpublish-legacy) which does have this class.

Can you please show the error + stack trace you get?

@fireflyfolio
Copy link
Author

fireflyfolio commented May 29, 2017

@lolautruche, sure, here is my stack trace :

`Whoops, looks like something went wrong.

1/1
UndefinedMethodException in TemplateDebugInfo.php line 29:
Attempted to call an undefined method named "hasInstance" of class "eZ\Publish\Core\MVC\Legacy\Kernel".
in /home/users/webthai/ezplatform-poc/vendor/ezsystems/legacy-bridge/bundle/Collector/TemplateDebugInfo.php line 29`

@fireflyfolio
Copy link
Author

fireflyfolio commented May 29, 2017

@lolautruche : And I didn't commit any code. It's just a remark... Sorry, I've just realized that I should have created an issue instead... ^^

Could you explain your remark please?

but should still work since Kernel extends ezpKernel (from ezpublish-legacy) which does have this class. ?

It seems the ezpKernel class doesn't define the hasInstance method... and we use eZ Publish Legacy 2014.11 which is the minimum version required by LegacyBridge according to its composer.json

@fireflyfolio
Copy link
Author

Moved to Issue: #94

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.

None yet

5 participants