. */ namespace Volkszaehler\Controller; use Volkszaehler\Definition; use Volkszaehler\Model; /** * Channel controller * * @author Steffen Vogel * @package default */ class ChannelController extends EntityController { /** * Get channel */ public function get($identifier) { $channel = parent::get($identifier); if ($channel instanceof Model\Channel) { return $channel; } else { throw new \Exception($identifier . ' is not a channel'); } } /** * Add channel */ public function add() { $channel = new Model\Channel($this->view->request->getParameter('type')); $this->setProperties($channel); $this->em->persist($channel); $this->em->flush(); if ($this->view->request->getParameter('setcookie')) { $this->setCookie($channel); } return $channel; } } ?>