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
Remove silly doctrine.$something.{$this->something}
pattern from factories
#76
Comments
After playing with the code some more, I agree with this wholeheartedly. Not quite sure how to go about it myself though. |
Seems like keeping the pattern <?php
use Zend\ServiceManager\AbstractFactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
class SuperDuperDoctrineFactory implements Zend\ServiceManager\AbstractFactoryInterface
{
public function canCreateServiceWithName(ServiceLocatorInterface $sl, $name, $requestedName)
{
// @todo this is over-simplified obviously
return 0 === strpos('doctrine.', $requestedName);
}
public function createServiceWithName(ServiceLocatorInterface $sl, $name, $requestedName)
{
// @todo pseudo-code
$service = match('doctrine.<$serviceType>.<$serviceName>', $requestedName);
$factory = $this->getFactory($serviceType, $serviceName);
return $factory->createService($sl);
}
} Thoughts? |
I've got this up and running locally in tandem with |
Handled in #226 |
The pattern in the subject currently makes it hard for the end user to provide own factories. It can still live as a sane default, but should be instead a fallback logic
The text was updated successfully, but these errors were encountered: