array("label"=>"Statistiche pagina"), self::STAT_TYPE_NOTIZIA=>array("label"=>"Statistiche notizia"), self::STAT_TYPE_BANNER_IMPRESSION=>array("label"=>"Statistiche pagina"), self::STAT_TYPE_BANNER_CLICK=>array("label"=>"Statistiche pagina") ); public function __construct($saveableObject = null){ parent::__construct($saveableObject); $requiredProps = array("user","content","source", "ip", "statType"); if (!$this->hasProperty("date")){ $this->date = new MongoDate(); } foreach ($requiredProps as $prop){ if (!$this->hasProperty($prop)){ throw new CoreException("Missing parameter '$prop' while calling ".get_called_class()."::__construct()"); } } if (!array_key_exists($this->statType, self::$STAT_TYPES)){ throw new CoreException("Invalid statistic type '".$this->statType."' while calling ".get_called_class()."::__construct()"); } } public function __set($attr,$value){ if (strcmp("statType", $attr)==0){ $value = intval($value); } return parent::__set($attr, $value); } public static function getCollectionName(){ return "statistics"; } } ?>