public function executeEmailNotify() { $c = new Criteria(); $c->add(NotificationEmailsPeer::USER_ID, $this->getRequestParameter('user_id')); $notifies = NotificationEmailsPeer::doSelectOne($c); if ($notifies != NULL) { $notifies->setOnOff($this->getRequestParameter('st')); $notifies->save(); } else { $c = new NotificationEmails(); $c->setUserId($this->getRequestParameter('user_id')); $c->setOnOff($this->getRequestParameter('st')); $c->save(); } $c = new Criteria(); $c->add(UserPeer::ID, $this->getRequestParameter('user_id')); $user = UserPeer::doSelectOne($c); $this->redirect('@profile?username=' . $user->getUsername()); }