File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
lib/public/AppFramework/Db Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,11 @@ public function delete(Entity $entity): Entity {
9595 * @since 14.0.0
9696 */
9797 public function insert (Entity $ entity ): Entity {
98+ if ($ entity instanceof SnowflakeAwareEntity) {
99+ /** @psalm-suppress DocblockTypeContradiction */
100+ $ entity ->generateId ();
101+ }
102+
98103 // get updated fields to save, fields have to be set using a setter to
99104 // be saved
100105 $ properties = $ entity ->getUpdatedFields ();
@@ -115,11 +120,7 @@ public function insert(Entity $entity): Entity {
115120 $ qb ->setValue ($ column , $ qb ->createNamedParameter ($ value , $ type ));
116121 }
117122
118- if ($ entity instanceof SnowflakeAwareEntity) {
119- /** @psalm-suppress DocblockTypeContradiction */
120- $ entity ->generateId ();
121- $ qb ->executeStatement ();
122- } elseif ($ entity ->id === null ) {
123+ if ($ entity ->id === null ) {
123124 $ qb ->executeStatement ();
124125 // When autoincrement is used id is always an int
125126 $ entity ->setId ($ qb ->getLastInsertId ());
You can’t perform that action at this time.
0 commit comments