File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments