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

Documentation section bloc Extensions for writers is empty #6

Open
2 tasks done
weierophinney opened this issue Dec 31, 2019 · 1 comment
Open
2 tasks done
Assignees
Labels
Bug Something isn't working Documentation

Comments

@weierophinney
Copy link
Member

After updating zend-feed to v2.10.3, it seems that the setInvokableClass to add personnal writer has changed. Giving the following error :

Method by name of setInvokableClass does not exist in Zend\Feed\Writer\ExtensionManager

I tried to find more information into your doc, but the bloc is empty with a TODOmention.

Code to reproduce the issue

extensions = Writer::getExtensionManager();
$extensions->setInvokableClass('MyEntryName','PathToMyEntryClass');
Writer::registerExtension('MyExtensionName');

Expected results

My extension well registered.
And the section doc completed.

Actual results

Method by name of setInvokableClass does not exist in Zend\Feed\Writer\ExtensionManager

Originally posted by @gbouyge at zendframework/zend-feed#86

@weierophinney weierophinney added Bug Something isn't working Documentation labels Dec 31, 2019
@weierophinney
Copy link
Member Author

@gbouyge

After updating zend-feed to v2.10.3, it seems that the setInvokableClass to add personnal writer has changed.

This method has been gone since version 2.6.0.

You can use the following:

/** @var \Zend\Feed\Reader\StandaloneExtensionManager $extensionManager */
$extensionManager = \Zend\Feed\Writer\Writer::getExtensionManager();
$extensionManager->add('My\Entry', \My\Entry::class);
\Zend\Feed\Writer\Writer::registerExtension('My');

var_dump($extensionManager->has('My\Entry')); // true
var_dump(\Zend\Feed\Writer\Writer::getExtensions()['entry']); // array {0 => 'My\Entry'}

or use the class names:

$extensionManager->add(\My\Entry::class, \My\Entry::class);
var_dump($extensionManager->has(\My\Entry::class)); // true

Originally posted by @froschdesign at zendframework/zend-feed#86 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Documentation
Projects
None yet
Development

No branches or pull requests

2 participants