nextras / orm

Orm with clean object design, smart relationship loading and powerful collections.
https://nextras.org/orm
MIT License
310 stars 57 forks source link

ToArrayConverter shouldn't skip isVirtual properties #103

Closed insekticid closed 8 years ago

insekticid commented 9 years ago
/**
 * @property Item        $item {m:1 ItemsRepository}
 * @property Type        $type {virtual}
 */
class Log extends Entity
{
    public function getterType() {
        return $this->item->type;
    }
}

$row is Nextras Orm Entity

$form = new \Nette\Forms\Container;
$form->addSelect('type');
$form->setDefaults($row->toArray());

default value for select named 'type' is empty because of skipping virtual properties

hrach commented 9 years ago

Yes, this seems to be u bug because in history this method was used for persistance.

hrach commented 8 years ago

I have implemented this, but I think for setting form defaults you should use a different aproach, some more specific maybe.