. */ namespace Volkszaehler\Controller; 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 uuid'); } } /** * Add channel */ public function add() { $channel = new Model\Channel($this->view->request->getParameter('type')); foreach ($this->view->request->getParameters() as $parameter => $value) { if (Model\PropertyDefinition::exists($parameter)) { $channel->setProperty($parameter, $value); } } $this->em->persist($channel); $this->em->flush(); return $channel; } } ?>