Inseriti metodi sperimentali per i callback su set delle variabili Dao testato IN LETTURA
74 lines
1.6 KiB
PHP
74 lines
1.6 KiB
PHP
<?php
|
|
/*
|
|
Author: Riccardo Di Dato
|
|
Creation Date: 23/dic/2015
|
|
*/
|
|
|
|
class DaoSaveableDefaultImplementation implements DaoSaveable {
|
|
private $collectionName;
|
|
// private $saveableObject;
|
|
private $constrainedObject;
|
|
|
|
|
|
public function __construct($collectionName, $saveableObject){
|
|
$this->collectionName = $collectionName;
|
|
// $this->saveableObject = $saveableObject;
|
|
$this->constrainedObject = new ConstrainedObject($saveableObject);
|
|
}
|
|
|
|
public function __set($attr,$value){
|
|
// $this->saveableObject->$attr = $value;
|
|
$this->constrainedObject->$attr = $value;
|
|
}
|
|
|
|
public function __get($attr){
|
|
// return $this->saveableObject->$attr;
|
|
return $this->constrainedObject->$attr;
|
|
}
|
|
|
|
public function __unset($attr){
|
|
// unset($this->saveableObject->$attr);
|
|
unset($this->constrainedObject->$attr);
|
|
}
|
|
|
|
/**
|
|
* (non-PHPdoc)
|
|
* @see DaoSaveable::getSaveableObj()
|
|
*/
|
|
public function getSaveableObj(){
|
|
// return $this->saveableObject->get();
|
|
return $this->constrainedObject->get();
|
|
}
|
|
|
|
/**
|
|
* (non-PHPdoc)
|
|
* @see DaoSaveable::getCollectionName()
|
|
*/
|
|
public function getCollectionName(){
|
|
return $this->collectionName;
|
|
}
|
|
|
|
/**
|
|
* (non-PHPdoc)
|
|
* @see DaoSaveable::buildFromSaveableObj()
|
|
*/
|
|
public static function buildFromSaveableObj($collectionName, $saveableObject){
|
|
return new static($collectionName, $saveableObject);
|
|
}
|
|
|
|
/**
|
|
* (non-PHPdoc)
|
|
* @see DaoSaveable::updateFromSaveableObj()
|
|
*/
|
|
public function updateFromSaveableObj($obj){
|
|
// $this->saveableObject = $obj;
|
|
$this->constrainedObject = new ConstrainedObject($saveableObject);
|
|
}
|
|
|
|
protected function getConstrainedObject(){
|
|
return $this->constrainedObject;
|
|
}
|
|
|
|
}
|
|
|
|
?>
|