Made definition of columns based on objects

This commit is contained in:
2019-05-29 17:55:30 +02:00
parent 8dbbb4d245
commit d93a02e779
10 changed files with 291 additions and 125 deletions

View File

@@ -36,6 +36,10 @@ abstract class AbstractCommonClubsModelFactory
protected abstract function fetchAttributes();
private $attributes = null;
/**
* @param boolean $force
* @return AbstractCommonClubsModelColumn[]
*/
public function getAttributes($force = False)
{
if($this->attributes === null || $force)
@@ -164,10 +168,15 @@ abstract class AbstractCommonClubsModelFactory
$obj = $this->generatePlainObject('new');
$obj->markAsNew(true);
$attribs = array_map(function($v){
return Null;
}, $this->getAttributes());
$obj->setValues($attribs);
$values = array();
foreach($this->getAttributes() as $a)
{
$values[$a->getAlias()] = null;
}
// $attribs = array_map(function($v){
// return Null;
// }, $this->getAttributes());
$obj->setValues($values);
$obj->fillDefaultValues();