Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zsoerenm opened this issue Sep 28, 2011 · 0 comments
Open

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

zsoerenm opened this issue Sep 28, 2011 · 0 comments

Comments

@zsoerenm
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant