• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

insert multiple rows in a saveall in cakephp

phpcakephpcakephp-2.0cakephp-2.1


PHP Snippet 1:

array(
    'Date' => array(
        0 => array(
            'date' => '08/05/2013',
        ),
        1 => array(
            'date' => '09/05/2013',
        )
    ),
)

PHP Snippet 2:

foreach($items as $lineItem){

    $this->Invoice->create();

    $this->Invoice->save(array(
        'user_id'=>$property['User']['id'],
        'invoice_id'=>$invId['Invoices']['id'],
        'item_id'=>$lineItem['item_number'],    
        'quantity'=>$lineItem['quantity'],
        'price'=>$lineItem['mc_gross']
    );

}

Related Snippets

PHP AWS Cognito 'Error executing "SignUp" : ResourceNotFoundException : User pool client XXXX does not exist

Json_Encode not returning html even i try to encode JSON_HEX_QUOT | JSON_HEX_TAG

php - add comma thousands separator but remove trailing zeros

How to convert a carbon into string, to take the date only?

Passing PHP JSON to Javascript: echo json_encode vs echo json declaration

Dropzone: Submit both form data and dropzone at once

PHP SoapClient: set a namespace without prefix

Install mysql client in docker image

Explain how this array transposing and flattening function works

oauth-private.key does not exist or is not readable

Target Laravelista is not instantiable

Filter array by skipping every nth element from the end

Smarty: undefined extension class 'Smarty_Internal_Method_Get_Template_Vars'

How to reset Laravel AuthManager/guards in between API calls in tests?

How do I do HTTP basic authentication using Guzzle?

About Contact Privacy policy Terms and conditions