array("label"=>"Valutazione"), self::STATUS_ACCEPTED=>array("label"=>"Accettata"), self::STATUS_REJECTED=>array("label"=>"Respinta") ); /** * saveableObject deve avere alemeno il campo notizia = notiziaId e il campo user = userId; * @param stdClass $saveableObject * @throws CoreException */ public function __construct($saveableObject){ parent::__construct($saveableObject); if (!$this->hasProperty("notizia") || strcmp($this->notizia,"")==0){ throw new CoreException("Impossible to build CommentoModel without field notizia"); } if (!$this->hasProperty("user") || strcmp($this->user,"")==0){ throw new CoreException("Impossible to build CommentoModel without field user"); } if (!$this->hasProperty("status") || strcmp($this->status,"")==0){ $this->status = self::STATUS_PENDING; } if (!$this->hasProperty("mailSent")){ $this->mailSent = false; } if (!$this->hasProperty("date")){ $this->date = new MongoDate(); } } public function __set($attr,$value){ if (strcmp("status", $attr)==0){ $value = intval($value); } return parent::__set($attr, $value); } public static function getCollectionName(){ return "commenti"; } } ?>