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

Non-inheritance resource models #39

Open
nohponex opened this issue May 28, 2016 · 1 comment
Open

Non-inheritance resource models #39

nohponex opened this issue May 28, 2016 · 1 comment
Labels
Milestone

Comments

@nohponex
Copy link
Member

nohponex commented May 28, 2016

Our goal is to get rid off resource Model inheritance drawbacks when extending an model

For example a major issue is get method implementation which relies on current model's getFields, getFilterable etc methods, modifications made for this method at the extended class are not effecting the behaviour of get, leading in errors or unnecessary rewrite of get method at the extended method.

Furthermore we have to improve and simplify the definitions of models.

class InternalModel
{
    function get
    function getById
}
class User extends ResourceModel
{
    protected static $model = null;

    public static getModel()
    {
        if (static::$model) {
            static::$model = new InternalModel()
                ->setPage(new Page(1))
        );
        return static::$model;
    }
}

in a controller

$users = User::get(new Page(25));

TODO


NOTES

  • We should look into get(..., $targetModel = null) solution if it works
@nohponex
Copy link
Member Author

nohponex commented May 28, 2016

Working on https://github.com/phramework/jsonapi/tree/3.x branch

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

No branches or pull requests

1 participant