Skip to content

enable quoteStrategy-Configuration #268

Closed
wants to merge 3 commits into from

3 participants

@Blaimi
Blaimi commented Sep 26, 2013

because doctrine/doctrine2#800 will not happen …

@bakura10
Doctrine member

I will let @Ocramius decide if you integrate this feature, but please handle the case where the quote strategy is a string so that you can fetch it from service locator (see how it's done for Naming strategy: https://github.com/doctrine/DoctrineORMModule/blob/master/src/DoctrineORMModule/Service/ConfigurationFactory.php#L66)

@Ocramius
Doctrine member
Ocramius commented Oct 7, 2013

This PR needs a rebase

@Ocramius Ocramius commented on the diff Oct 7, 2013
src/DoctrineORMModule/Service/ConfigurationFactory.php
@@ -75,6 +75,18 @@ public function createService(ServiceLocatorInterface $serviceLocator)
}
}
+ if ($quoteStrategy = $options->getQuoteStrategy()) {
+ if (is_string($quoteStrategy)) {
+ if (!$serviceLocator->has($quoteStrategy)) {
+ throw new InvalidArgumentException(sprintf('Quote strategy "%s" not found', $quoteStrategy));
+ }
+
+ $config->setQuoteStrategy($serviceLocator->get($quoteStrategy));
@Ocramius
Doctrine member
Ocramius added a note Oct 7, 2013

Probably too picky here, but you should also check what has been fetched and throw an exception if it wasn't what you were looking for.

@Blaimi
Blaimi added a note Oct 8, 2013

This code is adapted from the NamingStrategy a few lines above. If we change the code here, should we change it there too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Ocramius
Doctrine member
Ocramius commented Oct 7, 2013

Also: missing tests

@Blaimi Blaimi closed this Feb 3, 2015
@Blaimi
Blaimi commented Apr 28, 2016

This is a duplicate of #453

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.