views:

38

answers:

3

Well, imagine that we have a register form of a class Customer and we only ask three fields (name,surname,email) and after, when this user logged first time we want to complete this information.

First, we have in lib/form/doctrine a file called 'CustomerForm.class.php' wich is generated automatic on command line. In this file we 'setup' only 3 fields and validators and if we wanna use we do something like that:

$this->form = CustomerForm();

Second, we create manual another form named 'CustomerFormStep1.class.php' where we can setup for validate the other fields. But when we do..

$this->form = CustomerFormStep1();

it returns error: Fatal error: Class 'CustomerFormStep1' not found

What is wrong?

Thanks.

+1  A: 

Assuming you have the form defined as:

class CustomerFormStep1 extends sfForm

or similar (sfFormDoctrine etc), and named correctly like you say (CustomerFormStep1.class.php) and in lib/form, then Symfony should just pick the definition up fine. Did you clear the cache after creating and placing it in the right place? (symfony cc).

richsage
A: 

Haven't you read the tutorial? Extending forms is perfectly described in context with reh admin generator and can of course be applied to any case.

Felix Kling
A: 

Create the new CustomerFormStep1 class as @richsage instructed. Then, in your actions you can write something like:

public function executeLogin(){
 //before login
 $this->form = new CustomerForm();
}

public function executeLoggedIn(){
 $this->form = new CustomerFormStep1();
 //other steps
}
fenderplayer