Hi there Phalcon community,
My form->isValid() method gives me a fatal error
[Wed May 07 14:39:58 2014] [warn] [client 94.210.222.87] mod_fcgid: stderr: PHP Fatal error: Maximum recursion depth exceeded in /var/www/vhosts/mydomain.com/httpdocs/app/controllers/DebiteurenController.php on line 21, referer: https://mydomain.com/debiteuren/formulier
This the action
public function formulierAction($debiteurNummer = null) {
$this->view->formulierModus = (!is_null($debiteurNummer)) ? "wijzigen" : "aanmaken" ;
if(!is_null($debiteurNummer)) {
$form = new DebiteurFormulier(Debiteuren::findFirstBydebiteurnummer($debiteurNummer));
} else {
$form = new DebiteurFormulier();
}
if($this->request->isPost() && $form->isValid($this->request->getPost())) {
if(!is_null($debiteurNummer)) {
$dbModel = Debiteuren::findFirstBydebiteurnummer($debiteurNummer);
}else {
$dbModel = new Debiteuren();
}
$form->bind($this->request->getPost(), $dbModel);
if($dbModel->save()) {
$this->response->redirect('debiteuren');
}
}
$this->view->form = $form;
}
And this is my form class
class DebiteurFormulier extends Form {
public function initialize($debiteurData = NULL, $options = Array()) {
$bedrijfsnaam = new Text('bedrijfsnaam');
$bedrijfsnaam->addValidator(new PresenceOf( array('message' => 'Dit veld is verplicht.')));
$this->add($bedrijfsnaam);
$adres = new Text('adres');
$adres->addValidator(new PresenceOf( array('message' => 'Dit veld is verplicht.')));
$this->add($adres);
$postcode = new Text('postcode');
$postcode->addValidator(new PresenceOf( array('message' => 'Dit veld is verplicht.')));
$this->add($postcode);
$woonplaats = new Text('woonplaats');
$woonplaats->addValidator(new PresenceOf( array('message' => 'Dit veld is verplicht.')));
$this->add($woonplaats);
}
}
The strange thing is that it has worked with other projects, but they were on a lower version then this installation (1.3.1). The form builder seems to be working fine, since it does pass data in-to my form but when it comes down to the validation part the application crashes.
Help is much appreciated!