Answer the question
In order to leave comments, you need to log in
Symfony embedded forms
There is a scheme:
Doctrine accordingly creates 2 form classes: NewsForm and NewsTranslationForm
In NewsForm I do
Validation of the main form should take place when one of the embed forms is successfully validated.
How to implement this?
Tried the following:
NewsForm
NewsTranslationForm
In this variant for some reason sfValidatorOr of the main form does not work.
PS Symfony 1.4.8 with Doctrine ORM
News:
actAs:
I18n:
fields: [title, content]
Timestampable: ~
columns:
title:
type: string(255)
notnull: true
content:
type: clob
notnull: true
$this->embedI18n(array('ru', 'uk'));
....
$this->getValidatorSchema()->setPostValidator(
new sfValidatorOr(array(
$this->getValidator('ru')->getPostValidator(),
$this->getValidator('uk')->getPostValidator(),
))
);
.....
$this->setValidators(array(
'title' => new sfValidatorPass(),
'content' => new sfValidatorPass(),
));
$this->validatorSchema->setPostValidator(
new sfValidatorAnd(array(
new sfValidatorSchemaFilter('title', new sfValidatorString(array('max_length' => 255))),
new sfValidatorSchemaFilter('content', new sfValidatorString())
)));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question