updated doctrine proxies

updated controllers and interpreters to new channel model location
This commit is contained in:
Steffen Vogel 2010-07-20 00:32:52 +02:00
parent 5d394c1ccc
commit e6daf91cd9
5 changed files with 135 additions and 10 deletions

View file

@ -27,19 +27,18 @@ class Channel extends Controller {
// TODO authentification/indentification
public function get() {
$dql = 'SELECT c FROM Volkszaehler\Model\Channel\Channel c JOIN WHERE';
$dql = 'SELECT c FROM Volkszaehler\Model\Channel c';
$conditions = array();
if ($this->view->request->getParameter('uuid')) {
$conditions['uuid'] = $this->view->request->getParameter('uuid');
// TODO add conditions
}
if ($this->view->request->getParameter('ugid')) {
// TODO add conditions
}
if ($this->view->request->getParameter('indicator')) {
// TODO add conditions
}
$q = $this->em->createQuery($dql);

View file

@ -21,12 +21,15 @@
namespace Volkszaehler\Controller;
// TODO call as subcontroller from Controller\Channel::get()?
class Data extends Controller {
// TODO authentification/indentification
public function get() {
// TODO why not ucids?
$ids = explode(',', trim($this->view->request->getParameter('ids')));
$q = $this->em->createQuery('SELECT c FROM Volkszaehler\Model\Channel\Channel c WHERE c.id IN (' . implode(', ', $ids) . ')');
$q = $this->em->createQuery('SELECT c FROM Volkszaehler\Model\Channel c WHERE c.id IN (' . implode(', ', $ids) . ')');
$channels = $q->execute();
$from = ($this->view->request->getParameter('from')) ? (int) $this->view->request->getParameter('from') : NULL;
@ -35,7 +38,7 @@ class Data extends Controller {
foreach ($channels as $channel) {
$interpreter = $channel->getInterpreter($this->em);
$this->view->add($interpreter->getValues($from, $to, $groupBy));
$this->view->add($channel, $interpreter->getValues($from, $to, $groupBy));
}
}

View file

@ -35,7 +35,7 @@ abstract class Interpreter implements InterpreterInterface {
/*
* constructor
*/
public function __construct(\Volkszaehler\Model\Channel\Channel $channel, \Doctrine\ORM\EntityManager $em) {
public function __construct(\Volkszaehler\Model\Channel $channel, \Doctrine\ORM\EntityManager $em) {
$this->channel = $channel;
$this->em = $em;
}

View file

@ -29,7 +29,7 @@ use Doctrine\Common\Collections\ArrayCollection;
* @Entity
* @Table(name="channels")
*/
abstract class Channel extends Entity {
class Channel extends Entity {
/** @Column(type="string") */
protected $name;
@ -47,7 +47,7 @@ abstract class Channel extends Entity {
/** @Column(type="integer") */
private $resolution;
/** @Column(type="decimal") */
/** @Column(type="decimal", precision="5", scale="2") */
private $cost;
/*

View file

@ -0,0 +1,123 @@
<?php
namespace Volkszaehler\Model\Proxies;
/**
* THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE.
*/
class VolkszaehlerModelChannelProxy extends \Volkszaehler\Model\Channel implements \Doctrine\ORM\Proxy\Proxy
{
private $_entityPersister;
private $_identifier;
public $__isInitialized__ = false;
public function __construct($entityPersister, $identifier)
{
$this->_entityPersister = $entityPersister;
$this->_identifier = $identifier;
}
private function _load()
{
if (!$this->__isInitialized__ && $this->_entityPersister) {
$this->__isInitialized__ = true;
if ($this->_entityPersister->load($this->_identifier, $this) === null) {
throw new \Doctrine\ORM\EntityNotFoundException();
}
unset($this->_entityPersister);
unset($this->_identifier);
}
}
public function addData(\Volkszaehler\Model\Data $data)
{
$this->_load();
return parent::addData($data);
}
public function getInterpreter(\Doctrine\ORM\EntityManager $em)
{
$this->_load();
return parent::getInterpreter($em);
}
public function getName()
{
$this->_load();
return parent::getName();
}
public function setName($name)
{
$this->_load();
return parent::setName($name);
}
public function getDescription()
{
$this->_load();
return parent::getDescription();
}
public function setDescription($description)
{
$this->_load();
return parent::setDescription($description);
}
public function getUnit()
{
$this->_load();
return parent::getUnit();
}
public function getIndicator()
{
$this->_load();
return parent::getIndicator();
}
public function getResolution()
{
$this->_load();
return parent::getResolution();
}
public function setResolution($resolution)
{
$this->_load();
return parent::setResolution($resolution);
}
public function getCost()
{
$this->_load();
return parent::getCost();
}
public function setCost($cost)
{
$this->_load();
return parent::setCost($cost);
}
public function getId()
{
$this->_load();
return parent::getId();
}
public function getUuid()
{
$this->_load();
return parent::getUuid();
}
public function __sleep()
{
if (!$this->__isInitialized__) {
throw new \RuntimeException("Not fully loaded proxy can not be serialized.");
}
return array('name', 'description', 'indicator', 'data', 'resolution', 'cost', 'id', 'uuid');
}
}