getData('nb_views') + 1; $this->save(array( 'nb_views' => $nbViews, )); return $this; } /** * * count number of clicks (image adverts only) * * @return $this */ public function addClick() { $nbClicks = $this->getData('nb_clicks') + 1; $this->save(array( 'nb_clicks' => $nbClicks, )); return $this; } /** * * generate advert redirect url * * @return array */ public function link() { return array( 'module' => 'app', 'controller' => 'index', 'action' => 'advert-redirect', 'id' => $this->getData('id') ); } }