prepareCountryData example

/** * Creates a new Country entity using the passed params. * * @throws ValidationException * * @return CountryModel */
    public function create(array $params)
    {
        $this->checkPrivilege('create');

        $params = $this->prepareCountryData($params);

        $country = new CountryModel();
        $country->fromArray($params);

        $violations = $this->getManager()->validate($country);
        if ($violations->count() > 0) {
            throw new ValidationException($violations);
        }

        $this->getManager()->persist($country);
        $this->flush();

        
Home | Imprint | This part of the site doesn't use cookies.