CountryModel example


    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();

        return $country;
    }
Home | Imprint | This part of the site doesn't use cookies.