예제 #1
0
 /**
  * @param $row
  * @param \Model_DB_Data_Object $db_model
  * @return Model_DB_Data_Object
  */
 public function parseRow($row, Model_DB_Data_Object $db_model = null)
 {
     if (null === $db_model) {
         $db_model = new Model_DB_Data_Object();
     }
     return $db_model->setValue($row[Model_DB_Data_Table::FIELDS_VALUE])->setIdRoadFk($row[Model_DB_Data_Table::FIELDS_ID_ROAD_FK])->setId($row[Model_DB_Data_Table::FIELDS_ID]);
 }
예제 #2
0
 public function loadDataFromJSON($value)
 {
     $array = json_decode($value, true);
     $coordinates = $this->getCoordinates();
     foreach ($coordinates as $item) {
         $item->delete();
     }
     foreach ($array as $item) {
         $coordinate = new Model_DB_Data_Object();
         $coordinate->setIdRoadFk($this->getId());
         $coordinate->setValue($item);
         $coordinate->save();
     }
 }