Issues (879)

src/App/Fixtures/Fixtures/ShopProductFixture.php (1 issue)

1
<?php
2
/**
3
 * ShopProduct.php
4
 *
5
 * @since 23/04/17
6
 * @author gseidel
7
 */
8
9
namespace App\Fixtures\Fixtures;
10
11
use App\Fixtures\AbstractFixture;
12
use Enhavo\Bundle\ShopBundle\Entity\Product;
13
14
class ShopProductFixture extends AbstractFixture
15
{
16
    /**
17
     * @inheritdoc
18
     */
19
    function create($args)
20
    {
21
        $product = new Product();
22
        $product->setCode($args['code']);
23
        $product->setTitle($args['title']);
24
        $product->setPrice($args['price']);
25
26
        $product->setPicture($this->createImage($args['picture']));
27
        $product->setRoute($this->createRoute($args['url'], $product));
28
        $product->setTaxRate($this->getTaxRate($args['taxRate']));
0 ignored issues
show
The method setTaxRate() does not exist on Enhavo\Bundle\ShopBundle\Entity\Product. Did you maybe mean setTaxCategory()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
        $product->/** @scrutinizer ignore-call */ 
29
                  setTaxRate($this->getTaxRate($args['taxRate']));

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
29
30
        $product->setCreatedAt(new \DateTime());
31
        $product->setEnabled(true);
32
33
        $this->translate($product);
34
35
        return $product;
36
    }
37
38
    public function getTaxRate($code)
39
    {
40
        $repository = $this->container->get('sylius.repository.tax_rate');
41
        return $repository->findOneBy(['code' => $code]);
42
    }
43
44
    /**
45
     * @inheritdoc
46
     */
47
    function getName()
48
    {
49
        return 'ShopProduct';
50
    }
51
52
    /**
53
     * @inheritdoc
54
     */
55
    function getOrder()
56
    {
57
        return 70;
58
    }
59
}
60