map/system/connection update functionality (backend)

This commit is contained in:
exodus4d
2015-02-28 14:08:24 +01:00
parent 503a31c48e
commit 417961cd1e
54 changed files with 7173 additions and 337 deletions

View File

@@ -0,0 +1,58 @@
<?php
/**
* Created by PhpStorm.
* User: exodus4d
* Date: 26.02.15
* Time: 21:12
*/
namespace Model;
class ConnectionModel extends BasicModel{
protected $table = 'connection';
protected $fieldConf = array(
'mapId' => array(
'belongs-to-one' => 'Model\MapModel'
),
'type' => array(
'type' => self::DT_JSON
)
);
/**
* set an array with all data for a system
* @param $systemData
*/
public function setData($systemData){
foreach((array)$systemData as $key => $value){
if(!is_array($value)){
if($this->exists($key)){
$this->$key = $value;
}
}elseif($key == 'type'){
// json field
$this->$key = $value;
}
}
}
public function getData(){
$connectionData = [
'id' => $this->id,
'source' => $this->source,
'target' => $this->target,
'scope' => $this->scope,
'type' => $this->type,
'updated' => strtotime($this->updated)
];
return $connectionData;
}
}