2010-07-18 17:12:00 +02:00
|
|
|
<?php
|
2010-07-21 12:44:01 +02:00
|
|
|
/**
|
|
|
|
* @copyright Copyright (c) 2010, The volkszaehler.org project
|
2010-07-22 18:37:14 +02:00
|
|
|
* @package default
|
2010-07-21 12:44:01 +02:00
|
|
|
* @license http://www.opensource.org/licenses/gpl-license.php GNU Public License
|
2010-07-22 16:21:26 +02:00
|
|
|
*/
|
|
|
|
/*
|
2010-07-21 12:44:01 +02:00
|
|
|
* This file is part of volkzaehler.org
|
2010-07-18 17:12:00 +02:00
|
|
|
*
|
2010-07-21 12:44:01 +02:00
|
|
|
* volkzaehler.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* any later version.
|
2010-07-18 17:12:00 +02:00
|
|
|
*
|
2010-07-21 12:44:01 +02:00
|
|
|
* volkzaehler.org is distributed in the hope that it will be useful,
|
2010-07-18 17:12:00 +02:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2010-07-21 12:44:01 +02:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2010-07-18 17:12:00 +02:00
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2010-07-21 12:44:01 +02:00
|
|
|
* along with volkszaehler.org. If not, see <http://www.gnu.org/licenses/>.
|
2010-07-18 17:12:00 +02:00
|
|
|
*/
|
|
|
|
|
2010-07-19 18:55:18 +02:00
|
|
|
namespace Volkszaehler\Model;
|
2010-07-18 17:12:00 +02:00
|
|
|
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
|
|
|
|
|
|
/**
|
2010-07-21 12:44:01 +02:00
|
|
|
* Channel entity
|
2010-07-18 17:12:00 +02:00
|
|
|
*
|
2010-07-21 12:44:01 +02:00
|
|
|
* @author Steffen Vogel <info@steffenvogel.de>
|
2010-07-22 18:37:14 +02:00
|
|
|
* @package default
|
2010-07-22 10:32:51 +02:00
|
|
|
*
|
2010-07-18 17:12:00 +02:00
|
|
|
* @Entity
|
|
|
|
*/
|
2010-07-20 00:32:52 +02:00
|
|
|
class Channel extends Entity {
|
2010-07-18 17:12:00 +02:00
|
|
|
/**
|
2010-09-04 01:33:32 +02:00
|
|
|
* @OneToMany(targetEntity="Data", mappedBy="channel", cascade={"remove", "persist"})
|
2010-07-31 17:52:48 +02:00
|
|
|
* @OrderBy({"timestamp" = "ASC"})
|
2010-07-18 17:12:00 +02:00
|
|
|
*/
|
2010-07-20 22:43:08 +02:00
|
|
|
protected $data = NULL;
|
2010-07-22 10:32:51 +02:00
|
|
|
|
2010-08-28 03:27:14 +02:00
|
|
|
/** @ManyToMany(targetEntity="Aggregator", mappedBy="channels") */
|
|
|
|
protected $aggregators;
|
2010-07-25 23:17:30 +02:00
|
|
|
|
2010-07-21 12:44:01 +02:00
|
|
|
/**
|
2010-08-24 15:33:55 +02:00
|
|
|
* Constructor
|
2010-07-18 17:12:00 +02:00
|
|
|
*/
|
2010-08-28 03:27:14 +02:00
|
|
|
public function __construct($type, $properties = array()) {
|
|
|
|
parent::__construct($type, $properties);
|
2010-07-22 10:32:51 +02:00
|
|
|
|
2010-07-18 17:12:00 +02:00
|
|
|
$this->data = new ArrayCollection();
|
2010-07-25 23:17:30 +02:00
|
|
|
$this->groups = new ArrayCollection();
|
2010-07-18 17:12:00 +02:00
|
|
|
}
|
2010-07-22 10:32:51 +02:00
|
|
|
|
2010-07-21 12:44:01 +02:00
|
|
|
/**
|
2010-07-29 00:04:33 +02:00
|
|
|
* Add a new data to the database
|
2010-07-20 22:43:08 +02:00
|
|
|
* @todo move to Logger\Logger?
|
2010-07-18 17:12:00 +02:00
|
|
|
*/
|
|
|
|
public function addData(\Volkszaehler\Model\Data $data) {
|
|
|
|
$this->data->add($data);
|
|
|
|
}
|
2010-07-22 10:32:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|