public function addAction() { $this->view->disable(); if ($this->request->isPost()) { $category_id = $this->request->get('category_id'); $category_name = $this->request->get('category_name'); $cat = new PCategory(); $cat->category_id = $category_id; $cat->uri = preg_replace('/\\s+/', '-', iconv("UTF-8", "ASCII//TRANSLIT//IGNORE", transliterator_transliterate('Any-Latin; Latin-ASCII', $category_name))); $cat->updated = time(); $cat->ordered = PCategory::maximum(['column' => 'ordered']) + 1; $cat->active = 0; $cat->title = $category_name; $cat->level = 0; $cat->lang = 'ru'; $cat->save(); } }