DirectorObjectForm: prefill object with defaults

This commit is contained in:
Thomas Gelf 2015-08-02 15:18:55 +02:00
parent 44154fe914
commit 2bab21c2d8
1 changed files with 5 additions and 0 deletions

View File

@ -23,6 +23,11 @@ abstract class DirectorObjectForm extends QuickForm
if ($this->object === null) {
$class = $this->getObjectClassname();
$this->object = $class::create($values, $this->db);
foreach ($this->getValues() as $key => $value) {
if ($this->object->hasProperty($key)) {
$this->object->$key = $value;
}
}
} else {
if (! $this->object->hasConnection()) {
$this->object->setConnection($this->db);