Exemple #1
0
 /**
  * Retrieves the element's Datas values from the DataSotarage,
  * using the recived Id or the element's id if no id is provided.
  *
  * @param mixed $id the id of the element whose data we whant to read from de DS
  * @throws Exception
  *
  * @todo: in  arrays format ????
  */
 public function fillFromDSById($id = null)
 {
     if (isset($id)) {
         $this->setId($id);
     }
     if ($this->getId()) {
         $dataArray = $this->dataStorage->readElement($this);
         $this->fillFromArray($dataArray);
     } else {
         throw new Exception('The object of class: ' . $this->getClass() . " has no id so it can't be filled using method fillElementById");
     }
 }