Modificato metodo __set per model che utilizzando costanti di classe

This commit is contained in:
Riccardo Di Dato
2016-03-01 12:21:12 +01:00
parent 43943b40ac
commit e4c8f77d64
6 changed files with 44 additions and 0 deletions
@@ -24,6 +24,13 @@ class MediaModel extends Model implements MediaInterface{
$this->setMediaRenderer();
}
public function __set($attr,$value){
if (strcmp("mediaType", $attr)==0){
$value = intval($value);
}
return parent::__set($attr, $value);
}
public function setMediaRenderer(){
if($this->hasProperty("mediaType")){
if ($this->mediaType == self::TYPE_HTML5){
+9
View File
@@ -38,8 +38,17 @@ class CommentoModel extends Model{
}
public function __set($attr,$value){
if (strcmp("status", $attr)==0){
$value = intval($value);
}
return parent::__set($attr, $value);
}
public static function getCollectionName(){
return "commenti";
}
}
?>
+7
View File
@@ -34,6 +34,13 @@ class MailModel extends Model implements FDN_MailInterface{
}
}
}
public function __set($attr,$value){
if (strcmp("status", $attr)==0 || strcmp("priority", $attr)==0){
$value = intval($value);
}
return parent::__set($attr, $value);
}
public function getMailObject(){
$email = new PHPMailer();
@@ -30,6 +30,13 @@ class MailTemplateModel extends Model{
}
}
}
public function __set($attr,$value){
if (strcmp("status", $attr)==0){
$value = intval($value);
}
return parent::__set($attr, $value);
}
public static function getCollectionName(){
return "mailTemplate";
+7
View File
@@ -47,6 +47,13 @@ class NotiziaModel extends HasMediaModel{
return "notizia";
}
public function __set($attr,$value){
if (strcmp("category", $attr)==0 || strcmp("status", $attr)==0){
$value = intval($value);
}
return parent::__set($attr, $value);
}
}
?>
@@ -36,6 +36,13 @@ class StatisticModel extends Model {
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";