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

ElasticaToModelTransformer::findByIdentifiers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 2
crap 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