-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PD-105 Add Asset ExtractMappingEvent. * PD-105 Add UpdateIndexDataEvent for DataObjects and Assets. * PD-105 Add ExtractMappingEvent DataObjects. * Apply php-cs-fixer changes * PD-105 Use namespace for exception. --------- Co-authored-by: martineiber <martineiber@users.noreply.github.com>
- Loading branch information
1 parent
766d506
commit 0aed427
Showing
12 changed files
with
295 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under following license: | ||
* - Pimcore Commercial License (PCL) | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license http://www.pimcore.org/license PCL | ||
*/ | ||
|
||
namespace Pimcore\Bundle\GenericDataIndexBundle\Event\Asset; | ||
|
||
use Symfony\Contracts\EventDispatcher\Event; | ||
|
||
/** | ||
* Fires before the mapping will be sent to the search-server index. | ||
* Can be used to add mappings for customized additional fields. | ||
* You will find a description and example on how it works in the docs. | ||
*/ | ||
final class ExtractMappingEvent extends Event | ||
{ | ||
protected array $customFieldsMapping; | ||
|
||
public function __construct(array $customFieldsMapping) | ||
{ | ||
$this->customFieldsMapping = $customFieldsMapping; | ||
} | ||
|
||
public function getCustomFieldsMapping(): array | ||
{ | ||
return $this->customFieldsMapping; | ||
} | ||
|
||
public function setCustomFieldsMapping(array $customFieldsMapping): self | ||
{ | ||
$this->customFieldsMapping = $customFieldsMapping; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under following license: | ||
* - Pimcore Commercial License (PCL) | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license http://www.pimcore.org/license PCL | ||
*/ | ||
|
||
namespace Pimcore\Bundle\GenericDataIndexBundle\Event\Asset; | ||
|
||
use Pimcore\Bundle\GenericDataIndexBundle\Event\UpdateIndexDataEventInterface; | ||
use Pimcore\Model\Asset; | ||
use Symfony\Contracts\EventDispatcher\Event; | ||
|
||
/** | ||
* Fires before the data for assets gets updated in the search index. | ||
* Can be used to add additional customized attributes in the search index. | ||
* You will find a description and example on how it works in the docs. | ||
*/ | ||
final class UpdateIndexDataEvent extends Event implements UpdateIndexDataEventInterface | ||
{ | ||
protected Asset $asset; | ||
|
||
protected array $customFields; | ||
|
||
public function __construct(Asset $asset, array $customFields) | ||
{ | ||
$this->asset = $asset; | ||
$this->customFields = $customFields; | ||
} | ||
|
||
public function getElement(): Asset | ||
{ | ||
return $this->asset; | ||
} | ||
|
||
public function getCustomFields(): array | ||
{ | ||
return $this->customFields; | ||
} | ||
|
||
public function setCustomFields(array $customFields): self | ||
{ | ||
$this->customFields = $customFields; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under following license: | ||
* - Pimcore Commercial License (PCL) | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license http://www.pimcore.org/license PCL | ||
*/ | ||
|
||
namespace Pimcore\Bundle\GenericDataIndexBundle\Event\DataObject; | ||
|
||
use Pimcore\Model\DataObject\ClassDefinition; | ||
use Symfony\Contracts\EventDispatcher\Event; | ||
|
||
/** | ||
* Fires before the mapping will be sent to the search server index. | ||
* Can be used to add mappings for customized additional fields. | ||
* You will find a description and example on how it works in the docs. | ||
*/ | ||
final class ExtractMappingEvent extends Event | ||
{ | ||
protected ClassDefinition $classDefinition; | ||
|
||
protected array $customFieldsMapping; | ||
|
||
public function __construct(ClassDefinition $classDefinition, array $customFieldsMapping) | ||
{ | ||
$this->classDefinition = $classDefinition; | ||
$this->customFieldsMapping = $customFieldsMapping; | ||
} | ||
|
||
public function getClassDefinition(): ClassDefinition | ||
{ | ||
return $this->classDefinition; | ||
} | ||
|
||
public function getCustomFieldsMapping(): array | ||
{ | ||
return $this->customFieldsMapping; | ||
} | ||
|
||
public function setCustomFieldsMapping(array $customFieldsMapping): self | ||
{ | ||
$this->customFieldsMapping = $customFieldsMapping; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under following license: | ||
* - Pimcore Commercial License (PCL) | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license http://www.pimcore.org/license PCL | ||
*/ | ||
|
||
namespace Pimcore\Bundle\GenericDataIndexBundle\Event\DataObject; | ||
|
||
use Pimcore\Bundle\GenericDataIndexBundle\Event\UpdateIndexDataEventInterface; | ||
use Pimcore\Model\DataObject\Concrete; | ||
use Symfony\Contracts\EventDispatcher\Event; | ||
|
||
/** | ||
* Fires before the data for data objects gets updated in the search server index. | ||
* Can be used to add additional customized attributes in the search index. | ||
* You will find a description and example on how it works in the docs. | ||
*/ | ||
final class UpdateIndexDataEvent extends Event implements UpdateIndexDataEventInterface | ||
{ | ||
protected Concrete $dataObject; | ||
|
||
protected array $customFields; | ||
|
||
public function __construct(Concrete $dataObject, array $customFields) | ||
{ | ||
$this->dataObject = $dataObject; | ||
$this->customFields = $customFields; | ||
} | ||
|
||
public function getElement(): Concrete | ||
{ | ||
return $this->dataObject; | ||
} | ||
|
||
public function getCustomFields(): array | ||
{ | ||
return $this->customFields; | ||
} | ||
|
||
public function setCustomFields(array $customFields): self | ||
{ | ||
$this->customFields = $customFields; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under following license: | ||
* - Pimcore Commercial License (PCL) | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license http://www.pimcore.org/license PCL | ||
*/ | ||
|
||
namespace Pimcore\Bundle\GenericDataIndexBundle\Event; | ||
|
||
use Pimcore\Model\Element\ElementInterface; | ||
|
||
interface UpdateIndexDataEventInterface | ||
{ | ||
public function getElement(): ElementInterface; | ||
|
||
public function getCustomFields(): array; | ||
|
||
public function setCustomFields(array $customFields): self; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.