zendframework / zend-feed

Feed component from Zend Framework
BSD 3-Clause "New" or "Revised" License
166 stars 42 forks source link

Move zend-servicemanager to 'require' in composer.json. #9

Closed danmichaelo closed 9 years ago

danmichaelo commented 9 years ago

Fixes fatal error "Class 'Zend\ServiceManager\AbstractPluginManager' not found" when used as a stand-alone component.

Same issue as https://github.com/zendframework/zend-barcode/pull/5

Ocramius commented 9 years ago

@padraic what about this? IIRC, the dependency was made optional on request, but indeed denies using any of the factory code :-\

weierophinney commented 9 years ago

I made the original change, and the OP is wrong, at least with regards to the Reader subcomponent:

StandaloneExtensionManager is just that: standalone. It depends on no external dependencies, and is the default implementation.

@danmichaelo — can you please indicate the use case you have that raises the error? If we can reproduce it, I'll fix it to work standalone, instead of adding another dependency.

danmichaelo commented 9 years ago

Sure, thanks for looking into this! I'm using the Writer:

$ composer require zendframework/zend-feed
$ php -r 'require("vendor/autoload.php"); $feed = new Zend\Feed\Writer\Feed();'
PHP Fatal error:  Class 'Zend\ServiceManager\AbstractPluginManager' not found in /Users/danmichael/tmp/minimal/vendor/zendframework/zend-feed/src/Writer/ExtensionPluginManager.php on line 20
PHP Stack trace:
PHP   1. {main}() Command line code:0
PHP   2. Zend\Feed\Writer\AbstractFeed->__construct() Command line code:1
PHP   3. Zend\Feed\Writer\Writer::registerCoreExtensions() /Users/danmichael/tmp/minimal/vendor/zendframework/zend-feed/src/Writer/AbstractFeed.php:45
PHP   4. Zend\Feed\Writer\Writer::registerExtension() /Users/danmichael/tmp/minimal/vendor/zendframework/zend-feed/src/Writer/Writer.php:185
PHP   5. Zend\Feed\Writer\Writer::getExtensionManager() /Users/danmichael/tmp/minimal/vendor/zendframework/zend-feed/src/Writer/Writer.php:98
PHP   6. Zend\Feed\Writer\ExtensionManager->__construct() /Users/danmichael/tmp/minimal/vendor/zendframework/zend-feed/src/Writer/Writer.php:80
PHP   7. spl_autoload_call() /Users/danmichael/tmp/minimal/vendor/zendframework/zend-feed/src/Writer/Writer.php:32
PHP   8. Composer\Autoload\ClassLoader->loadClass() /Users/danmichael/tmp/minimal/vendor/zendframework/zend-feed/src/Writer/Writer.php:32
PHP   9. Composer\Autoload\includeFile() /Users/danmichael/tmp/minimal/vendor/composer/ClassLoader.php:301
PHP  10. include() /Users/danmichael/tmp/minimal/vendor/composer/ClassLoader.php:412

Fatal error: Class 'Zend\ServiceManager\AbstractPluginManager' not found in /Users/danmichael/tmp/minimal/vendor/zendframework/zend-feed/src/Writer/ExtensionPluginManager.php on line 20
weierophinney commented 9 years ago

Arrgghh! Evidently did not do the same work on the writer as I did on the reader. :person_frowning:

I'll get an alternate pull request out soon.

weierophinney commented 9 years ago

Closing in favor of #13, which adds Zend\Feed\Writer\StandaloneExtensionManager, the complement to Zend\Feed\Reader\StandaloneExtensionManager, and which was inadvertently omitted when we added the latter.