for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?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);