. */ namespace Volkszaehler\Model; use Doctrine\Common\Collections; use Volkszaehler\Util; /** * Entity superclass for all models with database persistance * * @author Steffen Vogel * @package default * * @Entity * @Table(name="entities") * @InheritanceType("SINGLE_TABLE") * @DiscriminatorColumn(name="type", type="string") * @DiscriminatorMap({"channel" = "Channel", "group" = "Group"}) */ abstract class Entity { /** * @Id * @Column(type="smallint", nullable=false) * @GeneratedValue(strategy="AUTO") */ protected $id; /** @Column(type="string", length=36, nullable=false) */ protected $uuid; /** * @OneToMany(targetEntity="Token", mappedBy="entity") */ protected $tokens = NULL; /** * @OneToMany(targetEntity="Property", mappedBy="entity") * @OrderBy({"key" = "ASC"}) */ protected $properties = NULL; public function __construct() { $this->uuid = Util\UUID::mint(); $this->tokens = new Collections\ArrayCollection(); $this->properties = new Collections\ArrayCollection(); } /** * * @param unknown_type $token */ public function validateToken($token) { } public function getToken() { } public function getProperty($name) { } public function setProperty($name) { } /** * Getter & setter */ public function getId() { return $this->id; } // read only public function getUuid() { return $this->uuid; } // read only } ?>