0
I’m dying to do this ,as as I work with 3 models within a form, and the form refers to the main model and the other 2 models are associated with this model.
Example:
<?php echo $this->Form->create('Escola', array('type' => 'file')); ?>
<?php echo $this->Form->input('nome', array('class' => 'form-control')); ?>
<?php echo $this->Form->input('descricao', array('class' => 'form-control')); ?>
<?php echo $this->Form->input('EscolaTeste.nome', array('class' => 'form-control')); ?>
<?php echo $this->Form->input('EscolaTeste.desc', array('class' => 'form-control')); ?>
<?php echo $this->Form->input('EscolaNova.nome', array('class' => 'form-control')); ?>
<?php echo $this->Form->input('EscolaNova.desc', array('class' => 'form-control')); ?>
<?php echo $this->Form->end(); ?>
And in time to save I use saveAll
, remembering that Escola
is the main model and EscolaTeste
and EscolaNova
sane hasMany
of Escola
And what’s going on?
– Ricardo
Solved, forgot what models in
hasMany
are treated as array, so the associative models have to have the name this waymodeloAssiado.0.field
– Michel Henriq