Completed
Pull Request — master (#1571)
by
unknown
10:12 queued 08:35
created

ElasticaToModelTransformer::findByIdentifiers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
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
    protected function findByIdentifiers(array $identifierValues, $hydrate)
32
    {
33
        return $this->registry
34
            ->getManager()
35
            ->getRepository($this->objectClass)
36
            ->findMany($identifierValues)
37
            ->toArray();
38
    }
39
}
40