<?php

/**
 * 
 * @author Peter Csubak (chuby)
 * @copyright Peter Csubak (chuby)
 * 
 * //Annotations:
 * @Table
 */
class Order extends Entity {
	
	/**
	 * @var string
	 * @Id(hashBy="<<customerId>><<orderTime>>")
	 * @Attribute(type="md5")
	 */
	protected $ID;
	
	/**
	 * @var string
	 * @Attribute(type="md5")
	 */
	protected $customerId;
	
	/**
	 * @var DateTime
	 * @Attribute(type="datetime")
	 */
	protected $orderTime;
	
	/**
	 * @var string
	 * @Attribute(type="string", length=7)
	 * Constraints(regex="^(before|after|in|need)$")
	 */
	protected $status;
	
	/**
	 * @var array
	 * @Select(type="Dvd", where={"OrderId" = "<<ID>>"}, metaselect=true, onSet="setOrderedDvds")
	 * @XmlArray(schemaName="mobile", elementName="e", valueType="Dvd")
	 * @XmlArray(schemaName="desktop", elementName="e", valueType="Dvd")
	 */
	protected $orderedDvds;
	
	/** @XmlSchema */
	public $desktop;
	
	/** @XmlSchema */
	public $mobile;
	
	
	public function setOrderedDvds($dvds){
		
	}
	
	public function __construct(){
		$this->desktop = "<order>".
							"<customerid>customerId</customerid>".
							"<ordertime>orderTime</ordertime>".
							"<status>status</status>".
							"<ordereddvds>orderedDvds</ordereddvds>".
						"</order>";
		
		$this->mobile = "<o>".
							"<orid>ID</orid>".	
							"<odvd>orderedDvds</odvd>".
						"</o>";
	}
	
}
?>