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

Error manage module.config.php with closures #41

Open
michalbundyra opened this issue Jan 10, 2020 · 2 comments
Open

Error manage module.config.php with closures #41

michalbundyra opened this issue Jan 10, 2020 · 2 comments

Comments

@michalbundyra
Copy link
Member

Hi guys, today I put a closure in my module.config.php to write a factory and apigility put a wrong code in my module.config.php break the entire application.

The factory:

 'service_manager' => array(
    'factories' => array(
            'testClosure' => function(){},

The factory after some save operation on apigility ui:

 'service_manager' => array(
    'factories' => array(
            'testClosure' => Closure::__set_state(array(
))

Originally posted by @edipoReboucas at zfcampus/zf-apigility-admin#236

@michalbundyra
Copy link
Member Author

Hi @edipoReboucas,

I do not know if you already solved this issue but in order to help others I would like to answer it.

It sounds like a cache issue. Apigility has enabled the option 'config_cache_enabled'.
But this option does not work when you have closure in your config because it is not possible to cache closure.

The solutions seems to create a factory class instead of a closure. You should not disable the config in order to fit your need because it is not a good way to work on zf2.

Regards


Originally posted by @dlevel at zfcampus/zf-apigility-admin#236 (comment)

@michalbundyra
Copy link
Member Author

To use closures with cache on, probably I put closures via Module at the time.


Originally posted by @edipoReboucas at zfcampus/zf-apigility-admin#236 (comment)

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

No branches or pull requests

1 participant