Files
fdn2/private/lib/dao/models/MailTemplateModel.php
T

48 lines
910 B
PHP

<?php
/*
Author: Riccardo Di Dato
Creation Date: 25/gen/2016
*/
class MailTemplateModel extends Model{
const STATUS_NEW = 0;
const STATUS_READY = 1;
const STATUS_COMPLETE = 2;
public function __construct($saveableObject = null){
parent::__construct($saveableObject);
$requiredProps = array("from","subject","body");
if (!$this->hasProperty("status")){
$this->status = self::STATUS_NEW;
}
if (!$this->hasProperty("date")){
$this->date = new MongoDate();
}
foreach ($requiredProps as $prop){
if (!$this->hasProperty($prop)){
throw new CoreException("Missing parameter '$prop' while calling MailTemplateModel::__construct()");
}
}
}
public function __set($attr,$value){
if (strcmp("status", $attr)==0){
$value = intval($value);
}
return parent::__set($attr, $value);
}
public static function getCollectionName(){
return "mailTemplate";
}
}
?>