src/Shell/BasicSeedShell.php
public function importTable(Table $Table, $records, array $options = []) {
		$defaultOptions = [
			'checkRules' => true,
			'checkExisting' => true,
		];
		$options = $options + $defaultOptions;

		foreach ($records as $record) {
			$action = ($record->isNew() ? 'Create' : 'Update');
			$result = $Table->save($record, $options);
			$key = $this->findKey($Table, $record);

			if ($result) {
				$this->verbose("<success>{$Table->alias()} ({$key}): {$action} successful.</success>");
			} else {
				$this->quiet("<warning>{$Table->alias()} ({$key}): {$action} failed.</warning>");
				$this->printValidationErrors(
					$Table->alias(),
					$this->findKey($Table, $record),
					$record->errors()
				);
			}
		}
	}
public function importTable(Table $Table, $records, array $options = []) {
		$defaultOptions = [
			'checkRules' => true,
			'checkExisting' => true,
		];
		$options = $options + $defaultOptions;

		foreach ($records as $record) {
			$action = ($record->isNew() ? 'Create' : 'Update');
			$result = $Table->save($record, $options);
			$key = $this->findKey($Table, $record);

			if ($result) {
				$this->verbose("<success>{$Table->alias()} ({$key}): {$action} successful.</success>");
			} else {
				$this->quiet("<warning>{$Table->alias()} ({$key}): {$action} failed.</warning>");
				$this->printValidationErrors(
					$Table->alias(),
					$this->findKey($Table, $record),
					$record->errors()
				);
			}
		}
	}
public function importTable ( Table $ Table , $ records , array $ options = [ ] ) { $ defaultOptions = [ 'checkRules' => true , 'checkExisting' => true , ] ; $ options = $ options + $ defaultOptions ; foreach ( $ records as $ record ) { $ action = ( $ record -> isNew ( ) ? 'Create' : 'Update' ) ; $ result = $ Table -> save ( $ record , $ options ) ; $ key = $ this -> findKey ( $ Table , $ record ) ; if ( $ result ) { $ this -> verbose ( "<success>{$Table->alias()} ({$key}): {$action} successful.</success>" ) ; } else { $ this -> quiet ( "<warning>{$Table->alias()} ({$key}): {$action} failed.</warning>" ) ; $ this -> printValidationErrors ( $ Table -> alias ( ) , $ this -> findKey ( $ Table , $ record ) , $ record -> errors ( ) ) ; } } }
Helper function to import a set of records for a single Table.

Used by imporTables().

@param Cake\ORM\Table $Table A Table instance to save records into.
@param array|\Generator $records An array of Entity records to save into the Table.
@param array $options Options to pass to save().
@return void
Helper function to import a set of records for a single Table .