buildMapping example

protected $columnInfo = [];

    public function __construct(
        Enlight_Components_Db_Adapter_Pdo_Mysql $db,
        ModelManager $em,
        Enlight_Event_EventManager $eventManager
    ) {
        $this->db = $db;
        $this->em = $em;
        $this->eventManager = $eventManager;

        $this->buildMapping();
    }

    /** * Returns a reference to the Doctrine EntityManager * * @return ModelManager */
    public function getEntityManager()
    {
        return $this->em;
    }

    
$indexer = $this->indexer[$name] ?? null;
        if ($indexer) {
            return $indexer;
        }

        throw new ElasticsearchIndexingException([\sprintf('Indexer for name %s not found', $name)]);
    }

    public function updateMappings(): void
    {
        foreach ($this->indexer as $indexer) {
            $mapping = $this->buildMapping($indexer);

            $this->client->indices()->putMapping([
                'index' => $this->adminEsHelper->getIndex($indexer->getName()),
                'body' => $mapping,
            ]);
        }
    }

    private function isIndexedEntityWritten(EntityWrittenContainerEvent $event): bool
    {
        foreach ($this->indexer as $indexer) {
            
Home | Imprint | This part of the site doesn't use cookies.