Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8104861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:59:40+00:00 2026-06-05T23:59:40+00:00

I have this $data array: (built on a shell, not a form) (debugged here)

  • 0

I have this $data array: (built on a shell, not a form)

(debugged here)

array(
(int) 0 => array(
    (int) 0 => 's511013t',
    (int) 1 => 'id3422',
    (int) 2 => '1'
),
(int) 1 => array(
    (int) 0 => 's511013t',
    (int) 1 => 'id3637',
    (int) 2 => '1'
)
)

And using saveMany :

$this->Dir->saveMany($data, array( 'validate' => 'false', 'fieldList' => array('name','dir_dataname', 'project_id'))); 

Saving fails with no error.

I’m not sure if my $data array is well formatted, (I’m confused whether it should have another level) I built it from sql selects, etc. However it does contain all info I need saved, single model.

I’m running all this from a Shell and it does work to save a single record provided the field names everytime:

// this works
$this->Dir->save(array('name' => $data[0][0], 'project_id' => $data[0][2], 'dir_dataname' => $data[0][1]));

Already read Saving your data, and I’d really like to use saveMany and a fieldList due to my custom $data format. (I wouldn’t like to have to insert field names on my $data).
(no sql_dump to show since is pretty cumbersome to get it from a shell task)

I’ve spent all evening trying to figure it out, can you point me in the right direction, Please?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T23:59:41+00:00Added an answer on June 5, 2026 at 11:59 pm

    IMHO, the keys in each arrays are not valid fields in your database table. They should represent the same name as your table field.
    When you build the array from sql, the output should look like these – an associative array:

    array(
    (int) 0 => array(
        (string) name => 's511013t',
        (string) dir_dataname => 'id3422',
        (string) project_id => '1'
    ),
    (int) 1 => array(
        (string) name => 's511013t',
        (string) dir_dataname => 'id3637',
        (string) project_id => '1'
    )
    )
    

    Cake2.0 Docs

    $this->Dir->saveMany($data);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this array Array ( [data] => Array ( [0] => Array (
I have this code to sort an array of objects. The data in the
I have converted an array to object data like this: <?php $myobject->data = (object)Array('zero','one','two');
I have a string like this: TEST.DATA.Data.COR.Point,2;TEST.DATA.Data.COR.Point,5;TEST.DATA.Data.COR.Point,12;TEST.DATA.Data.COR.Point,12;TEST.DATA.Data.COR.WordTOFIND,18 I have a list of array with
I have a long array of data ( n entities). Every object in this
I have an array of System.Xml.XmlNode with data similar to this: [0] = <Node1
I have an array and it has some data in it. This array contains
Say I have an object-like data record like this: $article = array( 'title' =>
i have an string data array which contains data like this 5~kiran 2~ram 1~arun
I have built an array, such as A = [a1,a2,...aN]. How to save this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.