Completed
Push — master ( 4e4cd8...063296 )
by Maksim
16s
created

ElasticaToModelTransformer   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 3
dl 0
loc 19
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A findByIdentifiers() 0 8 1
1
<?php
2
3
/*
4
 * This file is part of the FOSElasticaBundle package.
5
 *
6
 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace FOS\ElasticaBundle\Doctrine\PHPCR;
13
14
use FOS\ElasticaBundle\Doctrine\AbstractElasticaToModelTransformer;
15
16
/**
17
 * Maps Elastica documents with Doctrine objects
18
 * This mapper assumes an exact match between
19
 * elastica documents ids and doctrine object ids.
20
 */
21
class ElasticaToModelTransformer extends AbstractElasticaToModelTransformer
22
{
23
    /**
24
     * Fetch objects for theses identifier values.
25
     *
26
     * @param array $identifierValues ids values
27
     * @param bool  $hydrate          whether or not to hydrate the objects, false returns arrays
28
     *
29
     * @return array of objects or arrays
30
     */
31 1
    protected function findByIdentifiers(array $identifierValues, $hydrate)
32
    {
33 1
        return $this->registry
34 1
            ->getManager()
35 1
            ->getRepository($this->objectClass)
36 1
            ->findMany($identifierValues)
37 1
            ->toArray();
38
    }
39
}
40