Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
110 additions
and
81 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
This file was deleted.
Oops, something went wrong.
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,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AmaTeam\ElasticSearch\API\Annotation; | ||
|
||
/** | ||
* @Annotation | ||
* @Target("CLASS") | ||
*/ | ||
class Embeddable | ||
{ | ||
/** | ||
* Multi-type attribute: | ||
* - If set to null, real class parent will be used | ||
* - If set to string, it will be treated as parent class name | ||
* - If set to false, inheritance will be turned off | ||
*/ | ||
public $inherits; | ||
} |
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
30 changes: 0 additions & 30 deletions
30
src/Entity/Annotation/Listener/DocumentAnnotationListener.php
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
src/Entity/Annotation/Listener/EmbeddableAnnotationListener.php
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,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AmaTeam\ElasticSearch\Entity\Annotation\Listener; | ||
|
||
use AmaTeam\ElasticSearch\API\Annotation\Embeddable; | ||
use AmaTeam\ElasticSearch\Entity\Annotation\ClassAnnotationListenerInterface; | ||
use AmaTeam\ElasticSearch\Entity\Entity; | ||
use ReflectionClass; | ||
|
||
class EmbeddableAnnotationListener implements ClassAnnotationListenerInterface | ||
{ | ||
public function accept(ReflectionClass $class, Entity $entity, $annotation): void | ||
{ | ||
if (!($annotation instanceof Embeddable)) { | ||
return; | ||
} | ||
$parent = $annotation->inherits; | ||
if ($parent === null || $parent === true) { | ||
$parent = $class->getParentClass() ? $class->getParentClass()->getName() : null; | ||
} | ||
if (is_string($parent)) { | ||
$entity->setParentName($parent); | ||
} | ||
} | ||
} |
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