Skip to content

Commit

Permalink
Merge pull request #11 from nikehin/dev
Browse files Browse the repository at this point in the history
Ну теперь то точно заработает
  • Loading branch information
aak74 authored Dec 29, 2018
2 parents cac5b53 + 9c50ac6 commit 97dbf09
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aak74/bx-data",
"version": "0.5.4",
"version": "0.5.5",
"description": "Классы для удобного доступа к данным в 1C-Bitrix",
"license": "MIT",
"keywords": ["bitrix", "1c-bitrix", "classes", "akop", "highload blocks", "битрикс", "1С-битрикс"],
Expand Down
12 changes: 9 additions & 3 deletions src/Element/AbstractElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,15 @@ public function upsert(array $filter, array $params)
"filter" => $filter,
));

$primaryKey = $this->primaryKey;
$hasPrimaryKey = $item[$primaryKey] || $item[strtolower($primaryKey)];
if ($item && $hasPrimaryKey) {
$primaryKey = null;
if ($item[$this->primaryKey]) {
$primaryKey = $item[$this->primaryKey];
}
if ($item[strtolower($this->primaryKey)]) {
$primaryKey = $item[strtolower($this->primaryKey)];
}

if ($item && $primaryKey) {
$this->update($primaryKey, $params);
return $primaryKey;
}
Expand Down

0 comments on commit 97dbf09

Please sign in to comment.