[TYPO3-dev] Your opinion please: ZF and T3

Dmitry Dulepov dmitry.dulepov at gmail.com
Fri Jul 2 11:06:16 CEST 2010


Hi!

Christian Opitz - Netzelf wrote:
> I'm currently writing an extension that enables developers to develop
> plugins with the Zend Framework - so what i'm doing is sticking router,
> response, DB-adapter, module loaders and so on together to get them
> working within TYPO3. Works good so far and I'll release it in TER soon
> because i think its quite usefull for others too. (It's name will be ZFext)

I like the idea!

> Actually the typoscript generated by Zfext_ExtMgm::addPItoST43() is the
> same as that of the method in t3lib_extMgm. Except three differences.
> Code says it faster than words:
> 
> plugin.tx_zfextexample_pi1 = USER_INT
> plugin.tx_zfextexample_pi1 {
>     includeLibs = typo3conf/ext/zfext/plugin/class.tx_zfext.php
>     userFunc = tx_zfext->main
>     prefixId = tx_zfextexample_pi1
> }
> 
> I can live with the includeLibs and userFunc property but the prefixId
> bothers me somehow (BUT i need it in the zfext-plugin to resolve which
> plugin was called).

Don't call it "prefixId" :) Choose a better name and that's it. What about
"handlerClass" or something like that?

> As i saw ExtBase goes another way by not writing it's
> USER/USER_INT-object not in the plugin...-object but directly into
> tt_content.list.

I am not sure how Extbase does but in my opinion this should be in TS
because it adds extra clarity to the extension. It is also easier for other
devs to explore and find out how it works.

> Now what worries me for certain days is how i should do that - because i
> somehow have the feeling that USER/USER_INT-objects in the
> plugin-objects is not the worst method as i think that it gives a faster
> insight whats happening. What do you think about that?

I agree.

> Second thing that worries me is if i should support more types than the
> list_type - currently i do. Does anybody want to put that kind of plugin
> in another than the list_type?

If you have more flexibility – it is good. For example, I crated several
extra types (that "scary" kickstarter option). It is often good.

> And just to be complete, I'd like to ask you another last thing: The
> prefixId in the plugin-conf is the key to an entry in
> config.tx_zfext.resources.zfext where per default only the extKey is
> set. When you change the default options defined as static variable in
> Zfext_ExtMgm (actually defaultController, defaultAction, autoload,
> suffixInClassName and namespace) these will be found in this object too
> (Set by Zfext_ExtMgm::addPItoST43). So for instance when you register
> the above plugin like that:
> 
> Zfext_ExtMgm::addPItoST43($_EXTKEY, array(
>     'directory' => 'pi1',
>     'suffix' => '_pi1',
>     'cached' => false,
>     'suffixInClassName' => false
> ));

Why do you use "addPItoST43"? You are doing a new thing, so why do you have
to use those old cryptic names? Can't you give it a good speaking name? Do
it right from the beginning or it will never be good :)

> Do you like that way - or would you prefer to have the configuration for
> each plugin directly in it's USER-object? (I thought that this could
> sometimes lead to problems and misunderstandings)

I think TS is better. In general having just one way is better.

> P.S.:
> In the example above standard controller class will be in
> EXT:zfext_example/pi1/controllers/IndexController.php and must be named
> Tx_ZfextExample_IndexController (Same pattern for models, forms etc.)
> The complete TS-config for zfext in my current test-installation is that:

You use syntax for Extbase (Tx_ with upper case "T") but your file sytem
structure seems to be old. That's not consistent. Either use new file
system structure or old naming, don't mix both.

In general, if you do something new, do it right from the beginning, try
not to reuse old bad names or principles.

> config {
>     tx_zfext {

Is there any technical reason to use "config"? That array is loaded early
at each page. If you add a lot of info there, you increase memory
requirements for each request.

-- 
Dmitry Dulepov
TYPO3 expert / TYPO3 core&security teams member
Twitter: http://twitter.com/dmitryd
Read more @ http://dmitry-dulepov.com/




More information about the TYPO3-dev mailing list