重新格式化数组

In short, I need a way to change:

Array
(
    [CrmOrder] => Array
        (
            [crm_schedule_id] => 59
        )

)

...into this (using PHP)....

Array
(
    [CrmOrder] => Array
        (
            [0] => Array
                (
                    [crm_schedule_id] => 59
                )
        )
)

The reason I need to do this is because I want to use the CakePHP saveAll() function with an array that I'm getting from the Wizard Component. Cake's saveAll needs the data to be one level deeper because CrmOrder belongsTo CrmPerson which hasMany CrmOrder.

As this isn't necessarily a Cake specific question, I'm also adding the 'php' tag to this question.

You should be able to leverage the FormHelper to produce the intended output like so:

echo $this->Form->input('CrmOrder.0.crm_schedule_id');

(Note the 0 in dot-notation. See second code block on this page in the manual.)

$input  = array( /* your data */ );
$output = $input;
$output['CrmOrder'] = array($output['CrmOrder']);
$newArray = array();
foreach( $oldArray as $key => $value ) {
    $newArray[ $key ] = array( $value );
}

Demo:

$data = array(
  'CrmOrder' => array(
    'crm_schedule_id' => 59,
  ),
);

$data = array_map(function($v){return array($v);}, $data);

var_dump($data);