Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple action.class.php

I do have an module e.g. account. Of course you will find a file called in acount/actions/action.class.php.

The PHP-file action.class.php is getting big. Is it possible to extend it?

for an example:

/account/action/action.class.php
/account/action/action2.class.php

If it is possible, how does the code look like in action.class.php and in action2.class.php? And/or where should I enter something in a config-ymal-file?

Thanks in advance!

Craphunter

like image 275
craphunter Avatar asked Jul 27 '11 10:07

craphunter


2 Answers

Symfony actions can be declare in two flavors:

  1. A big actios.class.php file that inherit from sfActions
  2. Multiple xxxAction.class.php file that inherit from sfAction

The are both basically the same but these cant be mixed (you must decide if you want 123123 files, 1 per action, or one big fat file).

Here its the symfony reference on this matters: Symfony Front Controller - Actions check the Action section.

like image 125
guiman Avatar answered Oct 01 '22 15:10

guiman


It sounds like the action class is getting too big because you have too much stuff in it. I would suggest breaking it into multiple modules or moving relevant parts of the logic code into your models.

Adding an include for an action2 file is not how Symfony 1.4 is intended to be used and will likely just lead to all kinds of other headache.

like image 24
Tom Avatar answered Oct 01 '22 15:10

Tom