Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ejemplo de uso de Validator
<?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
You can’t perform that action at this time.