[TYPO3-ect] How to convert plugins to MVC/lib/div ?
Elmar Hinz
elmar.DOT.hinz at team.MINUS.red.DOT.net
Thu Jun 28 17:44:46 CEST 2007
He Stefan,
the first question is, if it makes sense to move existing projects
to MVC architecture. You know, never change a winning team.
I would recommend to test it with a new project first. If that test is
positive for you, you can consider to also migrate existing projects.
> If I understand it right, then my old plugins are some kind of
> 'controllers', but they also contain all that stuff for views and
> models. Right ?
Right. That's at least the way tslib_pibase works.
>
>
> Then it could go this way:
> - copy old 'tx_plugin_pi1' to get my new 'controler'
Better start with an empty new controller. Separate the old switch-case
function into action functions within that new class. Move SQL queries
into model class(es). Move template rendering into view class(es).
Maybe you "intuitively" did this kind of separation already in the past,
so that you already have a MVC architecture without using the buzz word.
Than there isn't mucht to do.
> - replace all references to pi_base (e.g. pi_link...()) with
> tx_lib_link etc.
Right. But one of the reasons that it is still alpha is, that a
resultbrowser is wanted.
>
> And what about my libraries:
> Should I create a plugin tx_mypersonal_lib where I put my stuff to new
> classes (and extend existing classes where it is reasonable) ?
> Maybe some parts of that could then go into the official tx_lib (if
> there is interest in it) ...
The bare minimum you need to use of lib/div is the controller to replace
the limited switch case functionality by an extendible controller. All the
rest is optional. You can combine it with your own libraries or others
likd ZEND or EZ. As you like it.
If you find functionality in your libraries that is missing in lib you
can also add it to lib or div. There are several options to do this:
a) Make a SVN branch of lib or div, to show what you want to do.
b) But patches into the bugs.typo3.org
c) Make an addon extension to lib: tx_lib__supercool (Use double
underscores to mark an addon key.)
Regards
Elmar
More information about the TYPO3-team-extension-coordination
mailing list