Skip to content

Commit

Permalink
Fix - PHP: When using setValue with a compound key, it wasn't possi…
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanJard committed Feb 2, 2021
1 parent 229a5dc commit 1043323
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Editor.php
Expand Up @@ -1212,11 +1212,18 @@ private function _insert( $values )
return null;
}

// Get values to generate the id, including from setValue, not just the
// submitted values
$all = array();
foreach ($this->_fields as $field) {
$this->_writeProp($all, $field->name(), $field->val( 'set', $values ));
}

// Was the primary key altered as part of the edit, if so use the
// submitted values
$id = count( $this->_pkey ) > 1 ?
$this->pkeyToValue( $values ) :
$this->_pkey_submit_merge( $id, $values );
$this->pkeyToValue( $all ) :
$this->_pkey_submit_merge( $id, $all );

// Join tables
for ( $i=0 ; $i<count($this->_join) ; $i++ ) {
Expand Down

0 comments on commit 1043323

Please sign in to comment.