Completed
Push — fulltext_indexing_test ( 07c79e...9fd5b8 )
by André
51:32 queued 25:03
created

DoctrineDatabase::remove()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
/**
3
 * File containing the DoctrineDatabase Content search Gateway class.
4
 *
5
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
6
 * @license For full copyright and license information view LICENSE file distributed with this source code.
7
 * @version //autogentag//
8
 */
9
namespace eZ\Publish\Core\Search\Legacy\Content\WordIndexer\Gateway;
10
11
use eZ\Publish\Core\Search\Legacy\Content\WordIndexer\Gateway;
12
use eZ\Publish\Core\Persistence\Database\DatabaseHandler;
13
use eZ\Publish\SPI\Persistence\Content;
14
use eZ\Publish\SPI\Persistence\Content\Type\Handler as SPITypeHandler;
15
16
/**
17
 * WordIndexer gateway implementation using the Doctrine database.
18
 */
19
class DoctrineDatabase extends Gateway
20
{
21
    /**
22
     * Database handler.
23
     *
24
     * @var \eZ\Publish\Core\Persistence\Database\DatabaseHandler
25
     */
26
    protected $dbHandler;
27
28
    /**
29
     * SPI Content Type Handler.
30
     *
31
     * Need this for being able to pick fields that are searchable.
32
     *
33
     * @var \eZ\Publish\SPI\Persistence\Content\Type\Handler
34
     */
35
    protected $typeHandler;
36
37
    /**
38
     * Construct from handler handler.
39
     *
40
     * @param \eZ\Publish\Core\Persistence\Database\DatabaseHandler $dbHandler
41
     * @param \eZ\Publish\SPI\Persistence\Content\Type\Handler $typeHandler
42
     */
43
    public function __construct(
44
        DatabaseHandler $dbHandler,
45
        SPITypeHandler $typeHandler
46
    ) {
47
        $this->dbHandler = $dbHandler;
48
        $this->typeHandler = $typeHandler;
49
    }
50
51
    /**
52
     * Add a version of a Content to index.
53
     *
54
     * @param \eZ\Publish\SPI\Persistence\Content $content
55
     */
56
    public function index(Content $content)
57
    {
58
        throw new \RuntimeException('Indexing are not supported by legacy search engine, see eZSearchEngine::addObject');
59
    }
60
61
    /**
62
     * Remove whole content or a specific version from index.
63
     *
64
     * @param mixed $contentId
65
     * @param mixed|null $versionId
66
     */
67
    public function remove($contentId, $versionId = null)
68
    {
69
        throw new \RuntimeException('Indexing removal not supported by legacy search engine, see eZSearchEngine::removeObject');
70
    }
71
}
72