On Mon, Jan 13, 2014 at 12:06 PM, Philip G <guice...@gmail.com> wrote:
> On Mon, Jan 13, 2014 at 4:11 AM, Stefano Torresi
> <web...@stefanotorresi.it>wrote:
>
>> So there you go: https://gist.github.com/stefanotorresi/8399139
>>
>> You may want to get it further and use an AbstractOption subclass to
>> enforce defaults and/or validate configs.
>>
>
> Oh. I see. I didn't think to use services that way. That works out well. I
> can even set a "class" index that has the class name to use, which would
> allow a simple method for DB Injections.
>
> Let me ask this now: would it be worth while just to set the while
> application config within a "Config" service? AbstractOption isn't
> necessary: it's an inhouse script only. There will be no outside users
> access and modifying the code. However, I do see that use in public code
> base; internally we can pressure our developers do to things right. I
> wanted DI for the purpose of unit testing.
>
>
>
>> By the way, yes, anonymous functions inside configurations array are not
>> cacheable, and so are object instances (i.e. using 'new Obj()' as an array
>> value).
>>
>>
> I was afraid of this. Albeit this might not be a bottle neck, speed is a
> concern of ours. We'll see if this has any micro-optimization speed
> implications in the end. Thanks!

Actually, from a performance perspective, factory classes are a much
better fit. The reason is that the code from them is only retrieved
and compiled when requested. When you use closures, those must be
compiled on each request.

(Ask Marco Pivetta and Michael Gallego about this sometime - I was
surprised, as well!)


-- 
Matthew Weier O'Phinney
Project Lead            | matt...@zend.com
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com


Reply via email to