Created
April 6, 2011 12:07
-
-
Save brikou/905543 to your computer and use it in GitHub Desktop.
Disable address validation for known customer, in AcmePizzaBundle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @param ExecutionContext $context | |
* @return bool | |
*/ | |
public function isValidAddress($context) | |
{ | |
if ($this->knownCustomer) { | |
$this->address = $this->em->getRepository('AcmePizzaBundle:Address')->findOneBy(array('phone' => $this->knownPhone)); | |
} else { | |
$context->getGraphWalker()->walkReference( | |
$this->address, | |
$context->getGroup(), | |
$context->getPropertyPath() . ".address", | |
true | |
); | |
} | |
if (!($this->address instanceof Address)) { | |
$context->addViolation('Invalid address given', array(), $this->address); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment