Search
 
SCRIPT & CODE EXAMPLE
 

PHP

saveAll get all id save cakephp

public $saved_ids = array(
		'insert' => array(
			'count' => 0, 'id' => array()
		),
		'update' => array(
			'count' => 0, 'id' => array()
		)
    );


function afterSave( $created, $options = array() ){
		if( $created ){
			$this->saved_ids['insert']['count']++;
			$this->saved_ids['insert']['id'][] = $this->getID();	// get insert lasted id into database (vilh)
		} else {
			$this->saved_ids['update']['count']++;
			$this->saved_ids['update']['id'][] = $this->getID();
		}

		return $this->saved_ids;
	}


if ($this->MemberBookFacility->saveAll($data_MemberBookFacility)) {

	pr ($this->MemberBookFacility->saved_ids['insert']['id']);	// get multiple ids
}
Comment

PREVIOUS NEXT
Code Example
Php :: how to get the list of available timezones in php 
Php :: [DoctrineDBALDBALException]Unknown database type enum requested, DoctrineDBALPlatformsMySqlPlatform may not support it. 
Php :: laravel nigerian time zone 
Php :: wp get category by id 
Php :: How to pass JavaScript variables to PHP? 
Php :: sustituir caracteres especiales php 
Php :: sanitize_text_field 
Php :: sort multidimensional array php by key 
Php :: search on taxonomy wordpress query 
Php :: remove index.php in codeigniter 
Php :: php slugify 
Php :: wordpress notice 
Php :: laravel collection chunk 
Php :: laravel order by relationship 
Php :: php convert array to number 
Php :: how to find this day is holiday in php day 
Php :: composer create project version 
Php :: laravel make model with migration 
Php :: php foreach count rows 
Php :: php connection mysqli database 
Php :: how to use php echo data in javascript 
Php :: mysqli loop 
Php :: php generate slug 
Php :: foreach loop 1-100 php 
Php :: sum of columns laravel eloquent 
Php :: php capitalize first letter 
Php :: laravel create seeder 
Php :: delete uploaded file php 
Php :: remove last all special character from string php 
Php :: twig is in string 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =