@@ -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,22 +1465,17 @@ 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
1483- if (empty ($ columns )) {
1484- $ identityColumn = $ this ->quoteStrategy ->getColumnName ($ this ->class ->identifier [0 ], $ this ->class , $ this ->platform );
1485- $ this ->insertSql = $ this ->platform ->getEmptyIdentityInsertSQL ($ tableName , $ identityColumn );
1471+ if ($ columns === []) {
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
1490- $ values = [];
1491- $ columns = array_unique ($ columns );
1477+ $ placeholders = [];
1478+ $ columns = array_unique ($ columns );
14921479
14931480 foreach ($ columns as $ column ) {
14941481 $ placeholder = '? ' ;
@@ -1502,15 +1489,13 @@ public function getInsertSQL()
15021489 $ placeholder = $ type ->convertToDatabaseValueSQL ('? ' , $ this ->platform );
15031490 }
15041491
1505- $ values [] = $ placeholder ;
1492+ $ placeholders [] = $ placeholder ;
15061493 }
15071494
1508- $ columns = implode (', ' , $ columns );
1509- $ values = implode (', ' , $ values );
1510-
1511- $ this ->insertSql = sprintf ('INSERT INTO %s (%s) VALUES (%s) ' , $ tableName , $ columns , $ values );
1495+ $ columns = implode (', ' , $ columns );
1496+ $ placeholders = implode (', ' , $ placeholders );
15121497
1513- return $ this -> insertSql ;
1498+ return sprintf ( ' INSERT INTO %s (%s) VALUES (%s) ' , $ tableName , $ columns , $ placeholders ) ;
15141499 }
15151500
15161501 /**
0 commit comments