[FLOW3-general] Interaction between two or more Packages
Daniel Felix
d.felix at codeworkz.net
Thu Jan 19 13:45:37 CET 2012
Hi Thomas!
I created a example of a simple shopstructur (done orders, current orders).
For example I'm try to build this with 3 packages:
1. Package (ShopManager) description: Controll all subpackages and tie them together to the whole shop application.
2. Package (ShopOrderManager) description: Controll all currently existing orders which haven't been sent to the customer
3. Package (ShopOrderArchiv) description: Controll and stores the already sent orders.
Structrur:
ShopManager
/Controller
/ActionController.php
/Domain
/Model
/User
/UserGroup
/Repository
/User -- stores the whole users, relation (one to many) to UserGroup
/UserGroup -- stores all usergroups
ShopOrderManager
/Controller
/OrdermanagerController.php -- controlls the current orders (stop order, delete order, new order...)
/Domain
/Model
/CurrentOrder
/Repository
/CurrentOrders -- stores all currentorders
ShopOrderArchiv
/Controller
/OrderarchivController.php -- controlls the archiv (pack order, delete order, display orders per year...)
/Domain
/Model
/ArchivOrder
/Repository
/ArchivOrders -- stores all done orders...
This is an example for a situation, which is a bit like mine today.
Now I want something like that:
User calls an url and get routed to the ShopManager Package. This Package generate some layout like this:
#######################
# Header #
#######################
# Menubar #
#######################
# currentOrders #
#######################
# archivedOrders #
#######################
# Footer #
#######################
Now i have some templates in for the currentOrders in my Package OrderManager and have a template for the archived ones in my OrderArchiv.
Here is some example for the callprocess itself:
User enters domain -> FLOW3 calls ShopManager -> ShopManager calls currentOrders and archiveOrders and render their subtemplates -> FLOW3 returns the page.
Maybe I'm completly on the wrong path.
Maybe it would be better to build it as one Package?
Structrur:
ShopManager
/Controller
/ActionController.php
/OrdermanagerController.php -- controlls the current orders (stop order, delete order, new order...)
/OrderarchivController.php -- controlls the archiv (pack order, delete order, display orders per year...)
/Domain
/Model
/User
/UserGroup
/CurrentOrder
/ArchivOrder
/Repository
/User -- stores the whole users, relation (one to many) to UserGroup
/UserGroup -- stores all usergroups
/CurrentOrders -- stores all currentorders
/ArchivOrders -- stores all done orders...
But I don't know if FLOW3 is able to resolve for example a route for two packages?
Example: domain.com/shop/orders
Should call: ordermanager and Orderarchiv for the currently logged in user
Well... I hope I could explain my sticking point a little bit more precise?
Best regards,
Daniel
Am 19.01.2012 um 11:05 schrieb Thomas Layh <thomas at layh.com>:
> I am currently not sure if my following answer is what you asked.
>
> What I have done with my fugrm-packages, I have written an abstract
> controller that is overwriting the template path. So my layout template is
> stored in the base package. The partials are free to use everywhere, but
> you have to specifiy a longer path in the template. This way the second
> package is using the layout from the base package. The navigation partial
> for example is also from the base package.
>
> The second package (the controller) is extending the abstract controller
> from the base package and has the layout path from the base package.
>
> Getting the correct repository shouldn't be a problem, no matter in which
> package you are at the moment.
>
> Just take a look at the following three links. I am not sure if this is
> what you asked, but this is what I understood.
>
> Here you can see how I overwrite the template pathes.
> https://gitorious.org/fugrm/fugrm-base/blobs/master/Classes/Controller/AbstractController.php
>
> Here I extend the controller from the base package
> https://gitorious.org/fugrm/fugrm-gallery/blobs/master/Classes/Controller/GalleryController.php
>
> Here I use the full pathes to the partial. If you do it this way, you have
> also to define the package when you include you css and js in the layout
> file.
> https://gitorious.org/fugrm/fugrm-base/blobs/master/Resources/Private/Layouts/Index.html
>
> There is always a initialize<yourActionName>Action for each of your action.
> I guess in your case it would be nice to also initialize the view depending
> on the current action, but I can not find something like that in the FLOW3
> action controller.
>
> Hope this helps or did I completely misunderstood your question?
>
> Greetings,
> Thomas
>
> On Thu, Jan 19, 2012 at 10:41, Daniel Felix <d.felix at codeworkz.net> wrote:
>
>> Ah okay. Thank you Thomas!
>>
>> Do you also have some solution for my problem with the package interaction.
>> The example for using two repositories / models in one template / view.
>>
>> Example:
>> Get users from repo 1 in package 1 and show them in the template which is
>> in package 3.
>> Also add the blogs from repo 2 and package 2?
>>
>> So that package 3 works like a manager/controller for all packages?
>>
>> Thanks in Advance,
>> Daniel
>>
>> Am 19.01.2012 um 08:30 schrieb Thomas Layh <thomas at layh.com>:
>>
>>> Hi Daniel,
>>>
>>> you can add the package to your Fluid action links and in this way you
>> can
>>> link from one package to another. I used this a while ago for the
>> Usergroup
>>> website and it works well.
>>>
>>>
>> https://gitorious.org/fugrm/fugrm-base/blobs/master/Resources/Private/Partials/Navigation.html
>>>
>>>
>>> Hope this helps.
>>>
>>> Greetings,
>>> Thomas
>>>
>>> On Wed, Jan 18, 2012 at 18:05, Daniel Felix <d.felix at codeworkz.net>
>> wrote:
>>>
>>>> Hey there,
>>>>
>>>>
>>>>
>>>> is there any defination for interactions between two packages?
>>>>
>>>>
>>>>
>>>> Some example:
>>>>
>>>> 1 Package for Usermanagement (LoginController, RegistrationController,
>>>> UserModel, UserRepository, .)
>>>>
>>>> 1 Package for a Blog (BlogController, BlogModel, BlogRepository, . etc.)
>>>>
>>>> 1 Package for some Articledatabase (same as above)
>>>>
>>>>
>>>>
>>>> Now the interaction examples:
>>>>
>>>> A user register and should be added to the userrepository. If his
>> usergroup
>>>> matches, he should be able to add some article to the articlerepository.
>>>>
>>>>
>>>>
>>>> Or another example:
>>>>
>>>> A user read some articles from the articlerepository. On the same page,
>> he
>>>> should see the last 5 blogs from the blogrepository.
>>>>
>>>>
>>>>
>>>> Is there any dynamic way to define this with some packages and link them
>>>> together to one application or do I have to write this all in one
>> package
>>>> to
>>>> have a functional application.
>>>>
>>>>
>>>>
>>>> I would prefer the first way, to reuse the packages itself in some other
>>>> projects.
>>>>
>>>>
>>>>
>>>> I've read your documentation but couldn't find some good example for
>> this
>>>> situation.
>>>>
>>>>
>>>>
>>>> Best regards
>>>>
>>>> _______________________________________________
>>>> FLOW3-general mailing list
>>>> FLOW3-general at lists.typo3.org
>>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
>>>>
>>> _______________________________________________
>>> FLOW3-general mailing list
>>> FLOW3-general at lists.typo3.org
>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
>> _______________________________________________
>> FLOW3-general mailing list
>> FLOW3-general at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
>>
> _______________________________________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
More information about the FLOW3-general
mailing list