Completed
Push — master ( b8dae5...46c150 )
by Gabriel
01:13
created

ProductImage::_construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Stockbase\Integration\Model\ResourceModel;
4
5
/**
6
 * Class StockItem
7
 * @package Stockbase\Integration\Model\ResourceModel
8
 */
9
class ProductImage extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
10
{
11
12
    /**
13
     * @var \Magento\Framework\EntityManager\EntityManager
14
     */
15
    protected $entityManager;
16
17
    /**
18
     * Constructor.
19
     */
20
    protected function _construct()
21
    {
22
        $this->_init('stockbase_product_images', 'id');
23
    }
24
25
    /**
26
     * @param $imageName
27
     * @param $productId
28
     * @param $ean
29
     * @return mixed
30
     */
31 View Code Duplication
    public function imageExists($imageName, $productId, $ean)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
32
    {
33
        $connection = $this->getConnection();
34
        $query = $connection->select()
35
            ->from(['s' => $this->getMainTable()], ['s.ean'])
36
            ->where('s.image = ? AND s.product_id = ? AND s.ean= ?', $imageName, $productId, $ean);
37
        $eans = $connection->fetchAll($query);
38
        return $eans;
39
    }
40
41
    /**
42
     * @return mixed
43
     */
44 View Code Duplication
    public function getProcessedEans()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
45
    {
46
        $connection = $this->getConnection();
47
        $query = $connection->select()
48
            ->from(['s' => $this->getMainTable()], ['s.ean'])
49
            ->group('s.ean');
50
        $eans = $connection->fetchAll($query);
51
        return $eans;
52
    }
53
54
}
55