[TYPO3-50-general] Package Organization to gradually increase a Package's functionality

Thomas Allmer at at delusionworld.com
Mon Jan 26 23:25:45 CET 2009


hey,

I'm currently struggling with a logical problem. Maybe someone could
enlighten me. (hopefully)

So I have 2 Packages:
DirectoryRepository
GitDirectoryRepository

Most of the work is done in "DirectoryRepository", it supports adding of
comments, person with roles, rating, creation of zip files...
for that it has multiple controller, for example
ListController.php => just shows a list of all saved "Directories"
   basically it does this:
     $directories = $this->directoryRepository->getLatest();
     store $directories in the view and render it

Now in the Package "GitDirectoryRepository" I want to use all the 
functionality of "DirectoryRepository" plus some modifications. So 
basically I don't want to copy the whole Package but I want it's whole 
feature... *hehe*

possible File structure to easier understand my dilemma (shortened 
filenames):

DirectoryRepository/Classes/Controller/ListController.php
DirectoryRepository/Classes/Controller/DetailController.php
DirectoryRepository/View/ListIndex.php
DirectoryRepository/View/DetailIndex.php
DirectoryRepository/Domain/Directory.php
and
GitDirectoryRepository/Domain/Directory.php

So to make it easier I only want to have one file in the second package, 
that just extends this Class to have an additional attribute (as the 
View just outputs every attribute I don't need to change anything there)

These are some possible solutions:

== massive extend ==
just extend every Class/File from DirectoryRepository and don't modify 
anything so I can go to the URL /GitDirectoryRepository/list/ and it 
would work. As these file would just do:
class ListController extends \F3\DirectoryRepository\Controller\List...

no other php code inside. So it's just there to be found and extended.
This should work, but it's boring work to just create all these files 
and extend them for nothing.

== common interface + configuration ==
let's use a common Interface for the Directory so I can configure 
"DirectoryRepository" to use 
\F3\GitDirectoryRepository\Domain\Directory.php instead of the original 
Directory.

This should work, needs only one file, but I would still use the URL 
/DirectoryRepository/list/.
And the thing is that I won't be able to create more views just for the 
"GitDirectoryRepository" right?

So this only helps me if I really just want to change a really really 
small thing.

== symlinks ==
ok, this won't work at all as the package path would be wrong.
But yeah I thought about it.

== routing? ==
would it be possible to use routing for this? I must say I didn't really 
get into them so far. That's why I'm asking.

What I was thinking off:
Is something like this possible - if I go to this URL
GitDirectoryRepository/list/ and I don't have a list controller there 
can I just "reroute" it to use the "DirectoryRepository" list controller 
but with the implementation of 
\F3\GitDirectoryRepository\Domain\Directory.php

Is it possible to configure this globally like if you don't find the 
Controller here, look at my "father" (so extend a package?)

== conclusion ==
I don't know if this is just bullshit and I don't get it right but, this 
all seems pretty complicated...

So if anyone has any ideas about this, I would be really happy to hear 
them. Even if it's just a "man this isn't possible" I would still want 
to hear it.

I mean I can always just pack everything in one package and give them a 
lot of options, but I think it would be just nicer this way.

with best regards

PS: this is not about "demanding" a feature, I was just wondering and if 
it's not possible just say it, I will still like FLOW3 :)
-- 
+---------------------------------+-----------------------------------+
| Thomas Allmer                   |   http://www.delusionworld.com    |
| E-mail: at at delusionworld.com    |   phone: +43 699 16217064         |
+---------------------------------+-----------------------------------+


More information about the TYPO3-project-5_0-general mailing list