ahDoctrineEasyEmbeddedRelationsPlugin : Ajout BDD (I18N)
Bonjour,
J'ai un petit soucis avec le plugin ahDoctrineEasyEmbeddedRelationsPlugin.
En effet, je n'arrive pas à enregistrer le form que je passe dans l'embedRelation...
Précision : Le form contient bien l'ensemble de mes champs. Je remplie le tout et valide. Je regarde ensuite dans ma BDD : les champs de la table peanut_actu (+translation) sont présents mais pas ceux de la table peanut_actu_page (+translation).
Voici mon schéma (je précise que je suis en i18n) :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
peanutActu:
actAs:
Timestampable: ~
Seoable: ~
I18n:
fields: [title]
actAs:
Sluggable: { fields: [title], uniqueBy: [lang, title] }
columns:
id:
primary: true
type: integer
autoincrement: true
title:
type: string(255)
author:
type: integer
notnull: true
status:
type: enum
values: [draft, publish]
default: draft
peanutActuPage:
actAs:
I18n:
fields: [title]
actAs:
Sluggable: { fields: [title], uniqueBy: [lang, title] }
columns:
id:
primary: true
type: integer
autoincrement: true
title:
type: string(255)
actu_id:
type: integer
relations:
peanutActu:
class: peanutActu
foreignAlias: peanutActuPage
onDelete: cascade
local: actu_id
foreign: id |
On a ici une relation de type manyToOne (une actu peut contenir plusieurs page).
Voici mon peanutActuForm.class.php :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
class peanutActuForm extends BasepeanutActuForm
{
public function configure()
{
parent::configure();
$user = self::getValidUser();
$this->useFields(array(
'status',
'created_at'
));
if(!$this->isNew()) {
$this->widgetSchema['created_at'] = new sfWidgetFormI18nDate(array(
'culture' => $user->getCulture(),
));
}
else{
unset($this['created_at']);
}
$this->widgetSchema->setHelps(array(
'status' => 'If you want to hide this entry for visitors',
'created_at' => 'Useful is you want to modify the date of the entry publication'
));
$this->embedI18n(array('fr', 'en'));
$this->widgetSchema->setLabel('fr', 'Français');
$this->widgetSchema->setLabel('en', 'English');
//$this->embedRelation('peanutSeo');
//$this->widgetSchema['peanutSeo']->setLabel('SEO');
$this->embedRelations(array(
'peanutActuPage' => array(
'considerNewFormEmptyFields' => array('title'),
'formFormatter' => null,
'multipleNewForms' => true,
'newFormsInitialCount' => 2,
'newFormsContainerForm' => null,
'newRelationButtonLabel' => '+',
'newRelationAddByCloning' => true,
'newRelationUseJSFramework' => 'jQuery',
)
));
} |
Voici mon peanutActuFormTranslation.class.php :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
class peanutActuTranslationForm extends BasepeanutActuTranslationForm
{
public function configure()
{
parent::configure();
$user = self::getValidUser();
$this->useFields(array(
'title',
'slug'
));
$this->widgetSchema['title'] = new sfWidgetFormHtml5InputText($options = array(), $attributes = array(
'required' => true,
'placeholder' => 'My Name'
));
$this->widgetSchema['slug'] = new sfWidgetFormHtml5InputText($options = array(), $attributes = array(
'placeholder' => 'my-name'
));
$this->widgetSchema->setHelps(array(
'title' => 'The actu title (required)',
'slug' => 'Not required but maybe usefull for your SEO',
));
}
} |
Voici mon peanutActuPageForm.class.php :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
class peanutActuPageForm extends BasepeanutActuPageForm
{
public function configure()
{
parent::configure();
unset($this['id']);
$this->widgetSchema->setFormFormatterName('div');
$this->embedI18n(array('fr', 'en'));
$this->widgetSchema->setLabel('fr', 'Français');
$this->widgetSchema->setLabel('en', 'English'); |
Voici mon peanutActuPageFormTranslation.class.php :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
class peanutActuPageTranslationForm extends BasepeanutActuPageTranslationForm
{
public function setup()
{
parent::setup();
$user = self::getValidUser();
$this->useFields(array(
'title',
'slug'
));
$this->widgetSchema['title'] = new sfWidgetFormHtml5InputText($options = array(), $attributes = array(
'required' => false,
'placeholder' => 'My Title'
));
$this->widgetSchema['slug'] = new sfWidgetFormHtml5InputText($options = array(), $attributes = array(
'placeholder' => 'my-title'
));
$this->widgetSchema->setHelps(array(
'title' => 'The item title (required)',
'slug' => 'Not required but maybe usefull for your SEO',
));
}
} |
Quelqu'un aurait-il une idée ou a eu le même problème ?
Merci d'avance...
<< X9 >>