Issues (22)

Manager/GeodisJsonApi.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace GeodisBundle\Manager;
4
5
use Doctrine\ORM\EntityManager;
0 ignored issues
show
The type Doctrine\ORM\EntityManager 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...
6
use GeodisBundle\DAO\Connection;
7
use GeodisBundle\DAO\Exception\ApiException;
8
9
/**
10
 * Author: Maxime Lambot <[email protected]>.
11
 * Author: Nils méchin <[email protected]>
12
 */
13
class GeodisJsonApi extends GeodisManager
14
{
15
    public function __construct(EntityManager $em)
16
    {
17
        parent::__construct($em);
18
    }
19
20
    public function setConfig($config)
21
    {
22
        parent::setConfig($config);
23
    }
24
25
    private function request($method, $service, $body = null)
26
    {
27
        Connection::setContentType('json');
28
29
        return Connection::Request($method, $service, $body);
30
    }
31
32
    public function persist($entity, $service)
33
    {
34
        $json = $entity->toJson();
35
        $result = $this->request('POST', $service, $json);
36
37
        return $result;
38
    }
39
}
40