I'm trying to use embedded forms on such a schema as :
News:
actAs: { Timestampable: ~ }
columns:
titre: { type: string(125), notnull: true }
texte: { type: string() }
date_News: { type: date(25), notnull: true }
actif: { type: boolean, notnull: true, default: true }
Book:
actAs: { Timestampable: ~ }
columns:
News_id: { type: integer(4) }
ean13: { type: string(13), notnull: true }
cmd_dedicace: { type: boolean, notnull: true, default: false }
actif: { type: boolean, notnull: true, default: true }
relations:
News:
alias: News
foreignType: many
foreignAlias: Books
onDelete: cascade
One News can have many Book.
Thus, I embed an BookForm in the NewsForm like this :
class NewsForm extends BaseNewsForm {
public function configure() {
$actuLivre = new Book();
$actu = $this->getObject();
$actuLivre->setNews($actu);
$addBookForm = new BookForm($actuLivre);
$this->embedForm('add_book', $addBookForm);
$this->embedRelation('Books');
Etc...
and the embedded form has :
class BookForm extends BaseBookForm {
public function configure() {
$this->widgetSchema['News_id'] = new sfWidgetFormInputHidden();
Etc...
}
}
Now, if I try to create a new News and to add an Book in one step, I
have this error:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'News_id'
cannot be null
Any idea of what I am missing here ?
--
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en.