This is the output:

Array
(
    [Property] => Array
        (
            [title] => lorem ipsum
            [descrizione] => Lorem ipsum dolor sit amet...
            [prezzo] => 500000
            [metratura] => 120
            [affitto] => 0
            [zones_id] => 2
            [types_id] => 2
        )

    [Image] => Array
        (
            [0] => Array
                (
                    [nomeFile] => lorempisum
                )

            [1] => Array
                (
                    [nomeFile] => loremipsum
                )

        )

)

What's wrong?


On 16 Ott, 22:21, "Edinei L. Cipriani" <[email protected]> wrote:
> Please, debug($this->data);
>
> 2009/10/16 ilcaduceo <[email protected]>
>
>
>
>
>
> > I have a problem with the saveAll function. There are two models,
> > Property and Images:
>
> > Property HasMany Image
> > Image belongTo Property
>
> > Also I have this form:
>
> > ------------------------------------------------------------------------------
> > <div class="properties form">
>
> > <?php echo $form->create('Property', array('type' => 'file'));?>
> >        <fieldset>
> >                <legend><?php __('Add Property');?></legend>
> >        <?php
> >                echo $form->input('Property.title');
> >                echo $form->input('Property.descrizione');
> >                echo $form->input('Property.prezzo');
> >                echo $form->input('Property.metratura');
> >                echo $form->input('Property.affitto');
> >                echo $form->input('Property.zones_id');
> >                echo $form->input('Property.types_id');
>
> >                echo $form->input('Image.0.nomeFile');
> >                echo $form->input('Image.1.nomeFile');
> >        ?>
> >        </fieldset>
>
> > <?php echo $form->end('Salva'); ?>
> > </div>
>
> > -------------------------------------------------------------------------------
>
> > and this is the action method in my controller:
>
> > ------------------------------------------------------------------------------
> > function add() {
>
> >                if (!empty($this->data)) {
> >                        $this->Property->create();
>
> >                        if ($this->Property->saveAll($this->data, array
> > ('validate'=>'first')) {
> >                                $this->Session->setFlash(__('The Property
> > has been saved', true));
> >                                $this->redirect(array('action'=>'add'));
> >                        } else {
> >                                $this->Session->setFlash(__('The Property
> > could not be saved.
> > Please, try again.', true));
> >                        }
> >                }
> >                $zones = $this->Property->Zone->find('list');
> >                $types = $this->Property->Type->find('list');
> >                $this->set(compact('zones', 'types'));
> >        }
>
> > ------------------------------------------------------------------------------
>
> > Now the result is that the Property model is saved but the related
> > model Image is not saved. Why? I have checked the array sintax and it
> > is correct, also i've checked the Model Fields and they are correct.
>
> > Can someone help me? Thak you...
>
> --
> Edinei L. Cipriani
> Desenvolvedor Colégio Trilingue Inovaçãowww.colegioinovacao.com.br
> Cursando Sistemas de Informação  - Unoesc Chapecó 1 Período
> Integrante do grupo Fool N Lost de algoritimos computacionais
> Fone 49 84149086
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to