Added support for optional columns in db
This commit is contained in:
parent
7c18f48b2a
commit
d48d7eb853
@ -117,6 +117,9 @@ abstract class AbstractCommonClubsModel
|
|||||||
if($v['type'] !== 'ref')
|
if($v['type'] !== 'ref')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if(is_null($vals[$k]))
|
||||||
|
continue;
|
||||||
|
|
||||||
$vals[$k] = $vals[$k]->getId();
|
$vals[$k] = $vals[$k]->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,6 +136,9 @@ abstract class AbstractCommonClubsModel
|
|||||||
if(empty($v['ref']))
|
if(empty($v['ref']))
|
||||||
throw new Exception('External reference of unknown class found.');
|
throw new Exception('External reference of unknown class found.');
|
||||||
|
|
||||||
|
if(empty($vals[$k]))
|
||||||
|
continue;
|
||||||
|
|
||||||
$vals[$k] = $this->loadExternalReferenceAsObject($v['ref'], $vals[$k]);
|
$vals[$k] = $this->loadExternalReferenceAsObject($v['ref'], $vals[$k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,6 +310,7 @@ abstract class AbstractCommonClubsModel
|
|||||||
$q->where("id = {$this->id}");
|
$q->where("id = {$this->id}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME Add additional filter to remove associations of the object
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
$db = Factory::getDbo();
|
$db = Factory::getDbo();
|
||||||
|
@ -30,6 +30,7 @@ abstract class AbstractCommonClubsModelFactory
|
|||||||
* - int
|
* - int
|
||||||
* - float
|
* - float
|
||||||
* - ref
|
* - ref
|
||||||
|
* - optional: boolean, if true, the field can be NULL
|
||||||
* - ref: (only with type='ref') The name of the class that is referenced
|
* - ref: (only with type='ref') The name of the class that is referenced
|
||||||
*/
|
*/
|
||||||
public abstract function getAttributes();
|
public abstract function getAttributes();
|
||||||
|
@ -9,7 +9,8 @@ class CommonClubsModelFactoryPlace extends AbstractCommonClubsModelFactory
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'name'=>array(),
|
'name'=>array(),
|
||||||
'club'=>array('col'=>'clubid', 'type'=>'ref', 'ref'=>'CommonClubsModelClub')
|
'club'=>array('col'=>'clubid', 'type'=>'ref', 'ref'=>'CommonClubsModelClub'),
|
||||||
|
'area'=>array('type'=>'int', 'optional'=>true)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user