Exemple #1
0
 /**
  * @param $id
  */
 public function handleActive($id)
 {
     $news = $this->newsRepository->get($id);
     $news->active(!$news->active());
     $this->newsRepository->save($news);
     if (!$this->isAjax()) {
         $this->redirect('default');
     }
     $this->redrawControl();
 }
Exemple #2
0
 /**
  * @param Form $form
  */
 public function formSucceeded(Form $form)
 {
     $values = $form->getValues();
     $news = new NewsEntity();
     $news->title($values->title);
     $news->active($values->active);
     $news->text($values->text);
     $news->url(strlen($values->url) > 0 ? Strings::webalize($values->url) : Strings::webalize($values->title));
     $news->dateAdd(new DateTime());
     $this->newsRepository->save($news);
 }