Skip to content

Commit 98e7a53

Browse files
committed
Remove BasicEntityPersister::$insertSql cache property
When the persister is extended to do a multi update, the caching is not wanted. The impact is minimal as the CPU/time overhead per query is much bigger and the prepared statement is not cached anyway.
1 parent 154a465 commit 98e7a53

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

src/Persisters/Entity/BasicEntityPersister.php

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,6 @@ class BasicEntityPersister implements EntityPersister
168168
*/
169169
protected $quotedColumns = [];
170170

171-
/**
172-
* The INSERT SQL statement used for entities handled by this persister.
173-
* This SQL is only generated once per request, if at all.
174-
*
175-
* @var string|null
176-
*/
177-
private $insertSql;
178-
179171
/**
180172
* The quote strategy.
181173
*
@@ -1473,18 +1465,13 @@ protected function getSelectManyToManyJoinSQL(array $manyToMany)
14731465
*/
14741466
public function getInsertSQL()
14751467
{
1476-
if ($this->insertSql !== null) {
1477-
return $this->insertSql;
1478-
}
1479-
14801468
$columns = $this->getInsertColumnList();
14811469
$tableName = $this->quoteStrategy->getTableName($this->class, $this->platform);
14821470

14831471
if (empty($columns)) {
1484-
$identityColumn = $this->quoteStrategy->getColumnName($this->class->identifier[0], $this->class, $this->platform);
1485-
$this->insertSql = $this->platform->getEmptyIdentityInsertSQL($tableName, $identityColumn);
1472+
$identityColumn = $this->quoteStrategy->getColumnName($this->class->identifier[0], $this->class, $this->platform);
14861473

1487-
return $this->insertSql;
1474+
return $this->platform->getEmptyIdentityInsertSQL($tableName, $identityColumn);
14881475
}
14891476

14901477
$values = [];
@@ -1508,9 +1495,7 @@ public function getInsertSQL()
15081495
$columns = implode(', ', $columns);
15091496
$values = implode(', ', $values);
15101497

1511-
$this->insertSql = sprintf('INSERT INTO %s (%s) VALUES (%s)', $tableName, $columns, $values);
1512-
1513-
return $this->insertSql;
1498+
return sprintf('INSERT INTO %s (%s) VALUES (%s)', $tableName, $columns, $values);
15141499
}
15151500

15161501
/**

0 commit comments

Comments
 (0)