Files
fdn2/private/lib/dao/models/PasswordRecoveryRequestModel.php
T
Riccardo Di Dato 8a29353046 Inserite le mail di gestione utenti ed amministratori con task annessi;
Inserito stile per commenti e form commenti;
Inseriti articoli home e lato destro delle pagine in base alle
visualizzazioni;
Bugfix vari;
2016-03-17 17:56:39 +01:00

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";
}
}
?>