Skip to content
New issue

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

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

Already on GitHub? # to your account

Improve Loading Model class with only construct #20

Open
tyx opened this issue Jul 24, 2014 · 2 comments
Open

Improve Loading Model class with only construct #20

tyx opened this issue Jul 24, 2014 · 2 comments

Comments

@tyx
Copy link
Contributor

tyx commented Jul 24, 2014

Currently, when you have a model you want to load, if it has only the constructor to set the value, it seems quiete obscure to know which properties are setted :

class MyModel 
{
    private $foo;

    private $bar;

    public function __construct($foo, $bar)
    {
         $this->foo = $foo;
         $this->bar = $bar;
   }
}
Given I load "My\Model (local)" fixtures where column "key" is the key:
    | key | __construct |
    | a1  | ["foo", "bar]  |

We should be able to "desactive" the construct and set the properties with column or any other way to achieve this result:

Given I load "My\Model (local)" fixtures where column "key" is the key:
    | key | foo   | bar    |
    | a1  | "foo" | "bar" |

Need to have a closer look in alice

@stephpy
Copy link
Collaborator

stephpy commented Jul 24, 2014

👍

@tyx tyx changed the title Load Model class with only construct Improve Loading Model class with only construct Jul 24, 2014
@tyx
Copy link
Contributor Author

tyx commented Jul 28, 2014

To desactivate the construct :
https://github.com/Ocramius/Instantiator

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants