Inserito stile per commenti e form commenti; Inseriti articoli home e lato destro delle pagine in base alle visualizzazioni; Bugfix vari;
52 lines
1.4 KiB
PHP
52 lines
1.4 KiB
PHP
<?php
|
|
/*
|
|
Author: Riccardo Di Dato
|
|
Creation Date: 17/mar/2016
|
|
*/
|
|
|
|
class PasswordRecoveryRequestModel extends Model{
|
|
|
|
public function __construct($saveableObject = null){
|
|
parent::__construct($saveableObject);
|
|
|
|
if (!$this->hasProperty("target")){
|
|
throw new CoreException("Missing parameter 'target' while calling PasswordRecoveryRequestModel::__construct()");
|
|
}
|
|
|
|
if (!array_key_exists("class", $this->target)){
|
|
throw new CoreException("Missing parameter 'target.class' while calling PasswordRecoveryRequestModel::__construct()");
|
|
}
|
|
|
|
if (!array_key_exists("id", $this->target)){
|
|
throw new CoreException("Missing parameter 'target.id' while calling PasswordRecoveryRequestModel::__construct()");
|
|
}
|
|
|
|
if (!$this->hasProperty("date")){
|
|
$this->date = new MongoDate();
|
|
}
|
|
|
|
if (!$this->hasProperty("sent")){
|
|
$this->sent = false;
|
|
}
|
|
}
|
|
|
|
public static function fromModel(Model $model){
|
|
$buildObj = new stdClass();
|
|
if ($model instanceof UserModel || $model instanceof AdminModel ){
|
|
$buildObj->target = array();
|
|
$buildObj->target["class"] = get_class($model);
|
|
$buildObj->target["id"] = $model->id;
|
|
|
|
return new self($buildObj);
|
|
}
|
|
else {
|
|
throw new CoreException("Impossible to build a PasswordRecoveryRequestModel from a model of class '".get_class($model)."' in PasswordRecoveryRequestModel::fromModel()");
|
|
}
|
|
}
|
|
|
|
public static function getCollectionName(){
|
|
return "passwordRecovery";
|
|
}
|
|
}
|
|
|
|
?>
|