symfony1 - Problems with redeclaring classes when using PHP's class_alias in a functional test -


I am using class_allage of PHP 5.3 to help with the process of my Simplified 1.4 (theory) forms. I use a single function to process multiple form pages, but using a switch statement to select a form class to use. Public function execution (sfWebRequest $ request) {switch ($ request-> GetParameter ('page')) {Case 'Page-1': Category_Allius ('MyFormPage1Form', 'FormAlias '); break; ...} $ this- & gt; Form = new formualius ($ obj); }

It works brilliantly while browsing the website, but fails in my functional tests, because when a page loads more than once, it will: < / P>

  $ browser-> Information ('1 - Edit Form 1 Page') - & gt; Received ('/ myforms / edit') - & gt; ;); () -> (* / myforms / edit ') - & gt; Start (->) with start (-> -> - (' feedback '); isStatusCode (200) -> & Gt; & gt; With IstatusCode (200) -> End ();  

I get 500 requests with the following error to get another request Receives:

The last request threw out the exception exception RuntimeException: PHP sent a warning error /.../apps/frontend/modules/.../actions/actions Class.php Line 225 (Class Form Allya not changed again)

This form makes it very difficult to check presentations (which usually post themselves back).

This is because the Symphony tester has the same Is there any way of 'Uniaz' or is there such a redistribution?

As an alternative solution, the name of the class to modify a variable and new asi Can not:

  Public Function Execution Edit (sfWebRequest $ request) {$ formType; Switch ($ request- & gt; getParameter ('Page')) {case 'page-1': $ formType = 'MyFormPage1Form'; break; ...} $ this- & gt; Form = new $ formType (); }  

This does not use class_alias, but maintains urgency in one place.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -