Firesphere /
silverstripe-elastic
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * class SynonymSet|Firesphere\ElasticSearch\Models\SynonymSet Index items from the CMS through a QueuedJob |
||
| 4 | * |
||
| 5 | * @package Firesphere\Elastic\Search |
||
| 6 | * @author Simon `Firesphere` Erkelens; Marco `Sheepy` Hermo |
||
| 7 | * @copyright Copyright (c) 2018 - now() Firesphere & Sheepy |
||
| 8 | */ |
||
| 9 | |||
| 10 | namespace Firesphere\ElasticSearch\Models; |
||
| 11 | |||
| 12 | use SilverStripe\ORM\DataObject; |
||
| 13 | use SilverStripe\ORM\FieldType\DBVarchar; |
||
| 14 | use SilverStripe\ORM\UniqueKey\UniqueKeyService; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Class \Firesphere\ElasticSearch\Models\SynonymSet |
||
| 18 | * |
||
| 19 | * @property string $Name |
||
| 20 | * @property string $Key |
||
| 21 | */ |
||
| 22 | class SynonymSet extends DataObject |
||
| 23 | { |
||
| 24 | private static $table_name = 'SynonymSet'; |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 25 | |||
| 26 | private static $db = [ |
||
|
0 ignored issues
–
show
|
|||
| 27 | 'Name' => DBVarchar::class, |
||
| 28 | 'Key' => DBVarchar::class |
||
| 29 | ]; |
||
| 30 | |||
| 31 | public function requireDefaultRecords() |
||
| 32 | { |
||
| 33 | if (!self::get()->count()) { |
||
| 34 | self::create([ |
||
| 35 | 'Name' => 'Default', |
||
| 36 | 'Key' => UniqueKeyService::singleton()->generateKey($this) |
||
| 37 | ])->write(); |
||
| 38 | } |
||
| 39 | parent::requireDefaultRecords(); |
||
| 40 | } |
||
| 41 | } |
||
| 42 |