Sorry I'd have to show my view and my model to:
view:
<?php foreach($data as $field => $value):
$rows = count($field);
?>
<tr>
<td><?php echo $value['Sign']['id']?></td>
<td> <?php echo $html->image('files/' . $value['File']
['name']) ?></td>
<td><?php echo $html->input('Time/'.$value['Sign']['id'] ,
array('multiple' => 'multiple','size' => '20'),true);
echo $html->tagErrorMsg('Time/'.$value['Sign']['id'], 'Favor
insira
o Tempo.'); ?> </td>
<?php echo $html->hidden('File/'. $value['Sign']['id'],
array('value'=>$value['Sign']['file_id']));?>
<?php endforeach; ?>
</tr>
</table>
</div>
<?php echo $html->hidden('Sign/movie_id', array('value'=>
$value['Sign']['movie_id']));?>
<?php echo $html->hidden('Sign/movie_file_id', array('value'=>
$value['Sign']['movie_file_id']));?>
<?php echo $html->hidden('Sign/movie_presentation_id',
array('value'=>$value['Sign']['movie_presentation_id']))?>
<div class="submit">
<?php echo $html->submit('Adicionar');?>
</div>
var $belongsTo = array(
'File' =>
array('className' => 'File',
'foreignKey' => 'file_id',
'conditions' => 'Sign.file_id
<> 0',
'fields' => '',
'order' => '',
'counterCache' => ''
),
'Movie' =>
array('className' => 'Movie',
'foreignKey' => 'movie_id',
'conditions' => 'Sign.movie_id
<> 0',
'fields' => '',
'order' => '',
'counterCache' => ''
),
/* 'MovieFile' =>
array('className' => 'Movie',
'foreignKey' => 'movie_file_id',
'conditions' => '',
'fields' => '',
'order' => '',
'counterCache' => ''
), */
'SignPresentation' =>
array('className' => 'Sign',
'foreignKey' =>
'movie_presentation_id',
'conditions' =>
'Sign.movie_presentation_id <> 0',
'fields' => '',
'order' => '',
'counterCache' => ''
),
);
Also my table fields for signs: [ id, time, file_id, movie_id,
movie_file_id, movie_presentation_id]
Thanks for your help. Alexandre.
On 12 jul, 16:41, kionae <[EMAIL PROTECTED]> wrote:
> Maybe I'm just not following your logic correctly, but why are you
> calling save in your if statement before you process the information
> that you're storing in $time_data for the second save?
>
> On Jul 12, 2:21 pm, clarkvr <[EMAIL PROTECTED]> wrote:
>
> > Hello everybody!!
>
> > I've an controler that save all my data, but adds an extra value on my
> > table field. My controller code that make this is:
>
> > if($this->Sign->save($this->data)) {
>
> > $data = $this->params['data'];
> > $num = count($data['Time']);
>
> > foreach($data['Time'] as $field =>
> > $value) {
> > $time_data = array('Sign' => array(
> > 'id' =>
> > $field,
> > 'time' => $data['Time'][$field],
> > 'file_id' => $data['File'][$field],
> > 'movie_id' => $data['Sign']
> > ['movie_id'],
> > 'movie_file_id' => $data['Sign']
> > ['movie_file_id'],
> > 'movie_presentation_id' =>
> > $data['Sign']['movie_presentation_id']));
> > $this->Sign->create();
> > $this->Sign->save($time_data,true);
> > }
> > $this->Session->setFlash('O slide foi
> > salvo');
> > $this->redirect('/');
>
> > Can you help me ? Thanks, Alexandre.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---