Skip to content

Let as_array() use __get() just as set_fields() uses __set() #48

Description

@zsoerenm

Here a simple example:

public function __get($key)
{
    if($key == 'date')
    {
        return date('d.m.Y',parent::__get($key));
    }
    return parent::__get($key);
}
public function __set($key, $value)
{
    if($key == 'date')
    {
        $value = strtotime($value);
    }
    parent::__set($key, $value);
}

as_array() does not return what I would suspect doing $model->date.

Although I see there are some issues using Automodeler_ORM as it uses __get() for 1:1 and 1:m relations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions