forked from FriendsOfSymfony/FOSElasticaBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndexConfig.php
More file actions
52 lines (46 loc) · 1.64 KB
/
IndexConfig.php
File metadata and controls
52 lines (46 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/*
* This file is part of the FOSElasticaBundle package.
*
* (c) FriendsOfSymfony <https://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FOS\ElasticaBundle\Configuration;
/**
* @phpstan-import-type TConfig from IndexConfigInterface
*/
class IndexConfig implements IndexConfigInterface
{
use IndexConfigTrait;
/**
* Indicates if the index should use an alias, allowing an index repopulation to occur
* without overwriting the current index.
*
* @var bool
*/
private $useAlias;
/**
* Constructor expects an array as generated by the Container Configuration builder.
*
* @phpstan-param TConfig $config
*/
public function __construct(array $config)
{
$this->elasticSearchName = $config['elasticsearch_name'] ?? $config['name'];
$this->name = $config['name'];
// @phpstan-ignore-next-line Ignored because of a bug in PHPStan (https://github.com/phpstan/phpstan/issues/5091)
$this->settings = $config['settings'] ?? [];
$this->useAlias = $config['use_alias'] ?? false;
// @phpstan-ignore-next-line Ignored because of a bug in PHPStan (https://github.com/phpstan/phpstan/issues/5091)
$this->config = $config['config'];
// @phpstan-ignore-next-line Ignored because of a bug in PHPStan (https://github.com/phpstan/phpstan/issues/5091)
$this->mapping = $config['mapping'];
$this->model = $config['model'];
}
public function isUseAlias(): bool
{
return $this->useAlias;
}
}