Skip to content

Commit 3cd72d5

Browse files
committed
test fixes
1 parent 5635f3c commit 3cd72d5

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Eav\Model\ResourceModel\Entity\Attribute;
10+
11+
use Magento\Framework\App\ResourceConnection;
12+
use Magento\Framework\DB\Adapter\AdapterInterface;
13+
14+
/**
15+
* Provide option value
16+
*/
17+
class OptionValueProvider
18+
{
19+
/**
20+
* @var AdapterInterface
21+
*/
22+
private $connection;
23+
24+
/**
25+
* @param ResourceConnection $connection
26+
*/
27+
public function __construct(ResourceConnection $connection)
28+
{
29+
$this->connection = $connection->getConnection();
30+
}
31+
32+
/**
33+
* Get EAV attribute option value by option id
34+
*
35+
* @param int $valueId
36+
* @return string|null
37+
*/
38+
public function get(int $valueId): ?string
39+
{
40+
$select = $this->connection->select()
41+
->from($this->connection->getTableName('eav_attribute_option_value'), 'value')
42+
->where('value_id = ?', $valueId);
43+
return $this->connection->fetchOne($select);
44+
}
45+
}

0 commit comments

Comments
 (0)