Quantcast

Zend\Di Examples

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Zend\Di Examples

Ralph Schindler-2
Hi all,

In line with yesterdays release (http://dz.zend.com/a/15448), I've
updated my ZF2ByExample repository with various use cases for
understanding how Zend\Di works:

   https://github.com/ralphschindler/ZF2ByExample

of course, it requires the library:

   https://github.com/zendframework/zf2/

And the DI quickstart read is a good starting place as well:

   http://framework.zend.com/wiki/display/ZFDEV2/Zend+DI+QuickStart


There are still things to accomplish, but it's already feature rich and
ready to study.  If you have any questions, find me on #zftalk.dev

-ralph




--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend\Di Examples

Sascha-Oliver Prolic
Hi all,

I am playing with the new Zend\Di component and ran into several issues,
1) Seems like I can't get any definitions from the Definition Compiler
(used together with the DirectoryScanner).
2) All Examples with Type-Hints are type-hints against concrete
classes. When I have type-hints against interfaces, not concrete
classes, I need to specify the dependencies by hand, they can't be
easily detected.
The class dependencies will be done by creating the definitions.
However I need to call "setProperty" on the instance manager, to
define all scalar values.
I couldn't do both, yet.
F.e. I have a
class Test {

    public function __construct(SomeInterface $interface, $someString)
    {
        // some code
    }
}
I am not sure how Zend\Di can handle that.
3) When I call "setInstantiator" on the
Zend\Di\Definition\Builder\PhpClass, I expected that i can handle
static calls to instatiate classes (fe. for factories, singletons ,
etc).
When I used it, i received: 'Zend\Di\Exception\RuntimeException' with
message 'Invalid instantiator'.

But perhabs it's just a documentation issue.

Additionally: I would find it very useful, if I could add classes to
definitions with a callback (could be a closure) to provide logic to
let the di container know how to instantiate the given class.

Regards

Sascha-Oliver Prolic

2011/6/15 Ralph Schindler <[hidden email]>:

> Hi all,
>
> In line with yesterdays release (http://dz.zend.com/a/15448), I've updated
> my ZF2ByExample repository with various use cases for understanding how
> Zend\Di works:
>
>  https://github.com/ralphschindler/ZF2ByExample
>
> of course, it requires the library:
>
>  https://github.com/zendframework/zf2/
>
> And the DI quickstart read is a good starting place as well:
>
>  http://framework.zend.com/wiki/display/ZFDEV2/Zend+DI+QuickStart
>
>
> There are still things to accomplish, but it's already feature rich and
> ready to study.  If you have any questions, find me on #zftalk.dev
>
> -ralph
>
>
>
>
> --
> List: [hidden email]
> Info: http://framework.zend.com/archives
> Unsubscribe: [hidden email]
>
>
>

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Loading...