tflori/orm

just another orm...

View the Project on GitHub tflori/orm

Build Status Test Coverage Maintainability Latest Stable Version Total Downloads

» API Reference » ORM\BulkInsert

ORM\BulkInsert

Table of Contents

Abstract

Methods

ORM\BulkInsert::__construct

public function __construct(
    \ORM\Dbal\Dbal $dbal, 
    string $class, 
    int $limit = 20, 
)
BulkInsert constructor.
Parameters
Parameter Type Description
$dbal ORM\Dbal\Dbal  
$class string  
$limit int  

ORM\BulkInsert::__construct

↑ top


ORM\BulkInsert::add

public function add(\ORM\Entity $entities): mixed
Add an entity to the bulk insert.
Returns mixed  
Throws ORM\Exception\InvalidArgument  
Parameters
Parameter Type Description
$entities ORM\Entity  

ORM\BulkInsert::add

↑ top


ORM\BulkInsert::finish

public function finish(): \ORM\Entity[]
Insert the outstanding entities and return all synced objects.
Returns ORM\Entity[]  

ORM\BulkInsert::finish

↑ top


ORM\BulkInsert::getLimit

public function getLimit(): int
Get the current limit of entities inserted at once.
Returns int  

ORM\BulkInsert::getLimit

↑ top


ORM\BulkInsert::limit

public function limit(int $limit): $this
Limit the amount of entities inserted at once.
Returns $this  
Parameters
Parameter Type Description
$limit int  

ORM\BulkInsert::limit

↑ top


ORM\BulkInsert::noAutoIncrement

public function noAutoIncrement(): $this
Disable updating the primary key by auto increment.

Caution: If this is disabled updating could cause a IncompletePrimaryKey exception.

Returns $this  

ORM\BulkInsert::noAutoIncrement

↑ top


ORM\BulkInsert::noUpdates

public function noUpdates(): $this
Disable updating entities after insert
Returns $this  

ORM\BulkInsert::noUpdates

↑ top


ORM\BulkInsert::onSync

public function onSync(callable $callback = null): $this
Executes $callback after insert

Provides an array of the just inserted entities in first argument.

Returns $this  
Parameters
Parameter Type Description
$callback callable  

ORM\BulkInsert::onSync

↑ top


ORM\BulkInsert::updateEntities

public function updateEntities(): $this
Enable updating entities after insert

Caution: This option will need to update the primary key by autoincrement which maybe is not supported by your db access layer (DBAL).

Returns $this  

ORM\BulkInsert::updateEntities

↑ top


ORM\BulkInsert::useAutoincrement

public function useAutoincrement(): $this
Enable updating the primary keys from autoincrement

Caution: Your db access layer (DBAL) may not support this feature.

Returns $this  

ORM\BulkInsert::useAutoincrement

↑ top