Wednesday, May 20, 2015

Re: Save Data

This should work.  Make sure you are using cake2.x and sameMany:
    $myarray = array(
            'AtendimentoPonto' => array(
                0 => array(
                    'id' => '78',
                    'atendimentos_id' => '1',
                    'pontos_id' => '1',
                    'ordem' => '1'
                ),
                1 => array(
                    'id' => '95',
                    'atendimentos_id' => '1',
                    'pontos_id' => '2',
                    'ordem' => '3'
                )
            )
        );



    $this->AtendimentoPonto->saveMany($myarray, array('deep' => true));


On Wednesday, May 20, 2015 at 1:13:04 PM UTC-5, Gustavo Martins wrote:
This is a firefox params view and the array in PHP is:

add - This works
array (size=1)    'AtendimentoPonto' =>       array (size=4)        'id' => string '' (length=0)        'atendimentos_id' => string '1' (length=1)        'pontos_id' => string '3' (length=1)        'ordem' => string '3' (length=1)

edit - This don't work
array (size=1)    'AtendimentoPonto' =>       array (size=2)        0 =>           array (size=4)            'id' => string '78' (length=2)            'atendimentos_id' => string '1' (length=1)            'pontos_id' => string '1' (length=1)            'ordem' => string '1' (length=1)        1 =>           array (size=4)            'id' => string '95' (length=2)            'atendimentos_id' => string '1' (length=1)            'pontos_id' => string '2' (length=1)            'ordem' => string '3' (length=1)
Thanks,
Gustavo Martins

2015-05-20 12:18 GMT-03:00 April DeRossett <april.d...@gmail.com>:
Can you post the code you are using to create the array?  


On Friday, May 15, 2015 at 6:38:53 AM UTC-5, Gustavo Martins wrote:
I try to save (edit) some information like data below and nothing happening.

AtendimentoPonto[0][id]:"88"
AtendimentoPonto[0][atendimentos_id]:"3"
AtendimentoPonto[0][pontos_id]:"3"
AtendimentoPonto[1][id]:"89"
AtendimentoPonto[1][atendimentos_id]:"3"
AtendimentoPonto[1][pontos_id]:"2"

But, this it's OK

AtendimentoPonto[id]:""
AtendimentoPonto[atendimentos_id]:"3"
AtendimentoPonto[pontos_id]:"1"

Why Cake don't recognize my array?

Thanks,
Gustavo Martins.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to a topic in the Google Groups "CakePHP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cake-php/bZhatTOY0ow/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cake-php+u...@googlegroups.com.
To post to this group, send email to cake...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


On Wednesday, May 20, 2015 at 1:13:04 PM UTC-5, Gustavo Martins wrote:
This is a firefox params view and the array in PHP is:

add - This works
array (size=1)    'AtendimentoPonto' =>       array (size=4)        'id' => string '' (length=0)        'atendimentos_id' => string '1' (length=1)        'pontos_id' => string '3' (length=1)        'ordem' => string '3' (length=1)

edit - This don't work
array (size=1)    'AtendimentoPonto' =>       array (size=2)        0 =>           array (size=4)            'id' => string '78' (length=2)            'atendimentos_id' => string '1' (length=1)            'pontos_id' => string '1' (length=1)            'ordem' => string '1' (length=1)        1 =>           array (size=4)            'id' => string '95' (length=2)            'atendimentos_id' => string '1' (length=1)            'pontos_id' => string '2' (length=1)            'ordem' => string '3' (length=1)
Thanks,
Gustavo Martins

2015-05-20 12:18 GMT-03:00 April DeRossett <april.d...@gmail.com>:
Can you post the code you are using to create the array?  


On Friday, May 15, 2015 at 6:38:53 AM UTC-5, Gustavo Martins wrote:
I try to save (edit) some information like data below and nothing happening.

AtendimentoPonto[0][id]:"88"
AtendimentoPonto[0][atendimentos_id]:"3"
AtendimentoPonto[0][pontos_id]:"3"
AtendimentoPonto[1][id]:"89"
AtendimentoPonto[1][atendimentos_id]:"3"
AtendimentoPonto[1][pontos_id]:"2"

But, this it's OK

AtendimentoPonto[id]:""
AtendimentoPonto[atendimentos_id]:"3"
AtendimentoPonto[pontos_id]:"1"

Why Cake don't recognize my array?

Thanks,
Gustavo Martins.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to a topic in the Google Groups "CakePHP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cake-php/bZhatTOY0ow/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cake-php+u...@googlegroups.com.
To post to this group, send email to cake...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


On Wednesday, May 20, 2015 at 1:13:04 PM UTC-5, Gustavo Martins wrote:
This is a firefox params view and the array in PHP is:

add - This works
array (size=1)    'AtendimentoPonto' =>       array (size=4)        'id' => string '' (length=0)        'atendimentos_id' => string '1' (length=1)        'pontos_id' => string '3' (length=1)        'ordem' => string '3' (length=1)

edit - This don't work
array (size=1)    'AtendimentoPonto' =>       array (size=2)        0 =>           array (size=4)            'id' => string '78' (length=2)            'atendimentos_id' => string '1' (length=1)            'pontos_id' => string '1' (length=1)            'ordem' => string '1' (length=1)        1 =>           array (size=4)            'id' => string '95' (length=2)            'atendimentos_id' => string '1' (length=1)            'pontos_id' => string '2' (length=1)            'ordem' => string '3' (length=1)
Thanks,
Gustavo Martins

2015-05-20 12:18 GMT-03:00 April DeRossett <april.d...@gmail.com>:
Can you post the code you are using to create the array?  


On Friday, May 15, 2015 at 6:38:53 AM UTC-5, Gustavo Martins wrote:
I try to save (edit) some information like data below and nothing happening.

AtendimentoPonto[0][id]:"88"
AtendimentoPonto[0][atendimentos_id]:"3"
AtendimentoPonto[0][pontos_id]:"3"
AtendimentoPonto[1][id]:"89"
AtendimentoPonto[1][atendimentos_id]:"3"
AtendimentoPonto[1][pontos_id]:"2"

But, this it's OK

AtendimentoPonto[id]:""
AtendimentoPonto[atendimentos_id]:"3"
AtendimentoPonto[pontos_id]:"1"

Why Cake don't recognize my array?

Thanks,
Gustavo Martins.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to a topic in the Google Groups "CakePHP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cake-php/bZhatTOY0ow/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cake-php+u...@googlegroups.com.
To post to this group, send email to cake...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: