Created
April 10, 2013 18:38
-
-
Save pablofmorales/5357255 to your computer and use it in GitHub Desktop.
Ejemplo de uso de Validator
This file contains 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 | |
namespace Services; | |
use Models\CountryMapper; | |
use Billing\Services\ServiceValidator; | |
use Symfony\Component\Validator\Constraints\NotNull; | |
class Country | |
{ | |
private $_countryMapper; | |
private $_validator; | |
public function __construct(ServiceValidator $validator, | |
CountryMapper $countryMapper) | |
{ | |
$this->_countryMapper = $countryMapper; | |
$this->_validator = $validator; | |
} | |
public function getAction($params) | |
{ | |
$this->_validator->validate( | |
$params, array( | |
"siteId" => new NotNull(), | |
"countryId" => new NotNull() | |
) | |
); | |
return $this->_countryMapper->getConfig( | |
$params["siteId"], | |
$params["countryId"] | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment