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

Provide an example using container DI and with autowiring #10

Open
nohponex opened this issue Jun 23, 2017 · 1 comment
Open

Provide an example using container DI and with autowiring #10

nohponex opened this issue Jun 23, 2017 · 1 comment
Milestone

Comments

@nohponex
Copy link
Member

nohponex commented Jun 23, 2017

$container = new League\Container\Container;

$container->add(
    \Phramework\ValidateFiller\IObjectValidatorFiller::class,
    \Phramework\ValidateFiller\ObjectValidatorFiller::class
);

$container->add(
    \Phramework\ValidateFiller\IArrayValidatorFiller::class,
    \Phramework\ValidateFiller\ArrayValidatorFiller::class
);

$container->add(
    \Phramework\ValidateFiller\EnumValidatorFiller::class,
    \Phramework\ValidateFiller\EnumValidatorFiller::class
);

// register the reflection container as a delegate to enable auto wiring
$container->delegate(
    new League\Container\ReflectionContainer
);

 $value = $container
    ->get(FillerRepository::class)
    ->fill($validator);
    ->fill($validator);

using http://container.thephpleague.com/

Experimented at #9

@nohponex nohponex added this to the 1.x milestone Jun 23, 2017
@nohponex nohponex changed the title Provide an example using container DI and auwiring Provide an example using container DI and with autowiring Jun 23, 2017
@nohponex
Copy link
Member Author

nohponex commented Jul 4, 2017

Perhaps it's better do have defaults instead of DI in FillerRepository

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