Issues (275)

api/src/Fixture/CaseTrait.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace App\Fixture;
4
5
use App\Entity\CaseEntity;
6
use Doctrine\Common\Persistence\ObjectManager;
0 ignored issues
show
The type Doctrine\Common\Persistence\ObjectManager was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Ds\Component\Database\Fixture\Yaml;
0 ignored issues
show
The type Ds\Component\Database\Fixture\Yaml was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
/**
10
 * Trait CaseTrait
11
 */
12
trait CaseTrait
13
{
14
    use Yaml;
15
16
    /**
17
     * @var string
18
     */
19
    private $path;
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function load(ObjectManager $manager)
25
    {
26
        $objects = $this->parse($this->path);
27
28
        foreach ($objects as $object) {
29
            $case = new CaseEntity;
30
            $case
31
                ->setUuid($object->uuid)
32
                ->setCustomId($object->custom_id)
33
                ->setOwner($object->owner)
34
                ->setOwnerUuid($object->owner_uuid)
35
                ->setIdentity($object->identity)
36
                ->setIdentityUuid($object->identity_uuid)
37
                ->setTitle((array) $object->title)
38
                ->setData((array) $object->data)
39
                ->setState($object->state)
40
                ->setPriority($object->priority)
41
                ->setTenant($object->tenant);
42
            $manager->persist($case);
43
            $this->setReference($object->uuid, $case);
44
        }
45
46
        $manager->flush();
47
    }
48
}
49