Skip to content

Commit

Permalink
all: Add fix to getAttribute function when empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémi Verrière committed Jul 18, 2019
1 parent 3a090ca commit c1cea51
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Entities/Model/ResourceModel/Entities.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,14 +464,20 @@ public function getAttribute($code, $entityTypeId)
{
$connection = $this->getConnection();

/** @var array $attribute */
$attribute = $connection->fetchRow(
$connection->select()
->from($this->getTable('eav_attribute'), array('attribute_id', 'backend_type'))
->where('entity_type_id = ?', $entityTypeId)
->where('attribute_code = ?', $code)
->limit(1)
);
return count($attribute) ? $attribute : false;

if (empty($attribute)) {
return false;
}

return $attribute;
}

/**
Expand Down

0 comments on commit c1cea51

Please sign in to comment.