private function getOrmEntityListenersNode()
    {
        $treeBuilder = new TreeBuilder('entity_listeners');

        if (method_exists($treeBuilder, 'getRootNode')) {
            $node = $treeBuilder->getRootNode();
        } else {
            // BC layer for symfony/config 4.1 and older
            $node = $treeBuilder->root('entity_listeners');
        }

        $normalizer = static function ($mappings) {
            $entities = [];

            foreach ($mappings as $entityClass => $mapping) {
                $listeners = [];

                foreach ($mapping as $listenerClass => $listenerEvent) {
                    $events = [];

                    foreach ($listenerEvent as $eventType => $eventMapping) {
                        if ($eventMapping === null) {
                            $eventMapping = [null];
                        }

                        foreach ($eventMapping as $method) {
                            $events[] = [
                                'type' => $eventType,
                                'method' => $method,
                            ];
                        }
                    }

                    $listeners[] = [
                        'class' => $listenerClass,
                        'event' => $events,
                    ];
                }

                $entities[] = [
                    'class' => $entityClass,
                    'listener' => $listeners,
                ];
            }

            return ['entities' => $entities];
        };

        $node
            ->beforeNormalization()
                // Yaml normalization
                ->ifTrue(static function ($v) {
                    return is_array(reset($v)) && is_string(key(reset($v)));
                })
                ->then($normalizer)
            ->end()
            ->fixXmlConfig('entity', 'entities')
            ->children()
                ->arrayNode('entities')
                    ->useAttributeAsKey('class')
                    ->prototype('array')
                        ->fixXmlConfig('listener')
                        ->children()
                            ->arrayNode('listeners')
                                ->useAttributeAsKey('class')
                                ->prototype('array')
                                    ->fixXmlConfig('event')
                                    ->children()
                                        ->arrayNode('events')
                                            ->prototype('array')
                                                ->children()
                                                    ->scalarNode('type')->end()
                                                    ->scalarNode('method')->defaultNull()->end()
                                                ->end()
                                            ->end()
                                        ->end()
                                    ->end()
                                ->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end();

        return $node;
    }
private function getOrmEntityListenersNode()
    {
        $treeBuilder = new TreeBuilder('entity_listeners');

        if (method_exists($treeBuilder, 'getRootNode')) {
            $node = $treeBuilder->getRootNode();
        } else {
            // BC layer for symfony/config 4.1 and older
            $node = $treeBuilder->root('entity_listeners');
        }

        $normalizer = static function ($mappings) {
            $entities = [];

            foreach ($mappings as $entityClass => $mapping) {
                $listeners = [];

                foreach ($mapping as $listenerClass => $listenerEvent) {
                    $events = [];

                    foreach ($listenerEvent as $eventType => $eventMapping) {
                        if ($eventMapping === null) {
                            $eventMapping = [null];
                        }

                        foreach ($eventMapping as $method) {
                            $events[] = [
                                'type' => $eventType,
                                'method' => $method,
                            ];
                        }
                    }

                    $listeners[] = [
                        'class' => $listenerClass,
                        'event' => $events,
                    ];
                }

                $entities[] = [
                    'class' => $entityClass,
                    'listener' => $listeners,
                ];
            }

            return ['entities' => $entities];
        };

        $node
            ->beforeNormalization()
                // Yaml normalization
                ->ifTrue(static function ($v) {
                    return is_array(reset($v)) && is_string(key(reset($v)));
                })
                ->then($normalizer)
            ->end()
            ->fixXmlConfig('entity', 'entities')
            ->children()
                ->arrayNode('entities')
                    ->useAttributeAsKey('class')
                    ->prototype('array')
                        ->fixXmlConfig('listener')
                        ->children()
                            ->arrayNode('listeners')
                                ->useAttributeAsKey('class')
                                ->prototype('array')
                                    ->fixXmlConfig('event')
                                    ->children()
                                        ->arrayNode('events')
                                            ->prototype('array')
                                                ->children()
                                                    ->scalarNode('type')->end()
                                                    ->scalarNode('method')->defaultNull()->end()
                                                ->end()
                                            ->end()
                                        ->end()
                                    ->end()
                                ->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end();

        return $node;
    }
private function getOrmEntityListenersNode ( ) { $ treeBuilder = new TreeBuilder ( 'entity_listeners' ) ; if ( method_exists ( $ treeBuilder , 'getRootNode' ) ) { $ node = $ treeBuilder -> getRootNode ( ) ; } else { // BC layer for symfony/config 4.1 and older $ node = $ treeBuilder -> root ( 'entity_listeners' ) ; } $ normalizer = static function ( $ mappings ) { $ entities = [ ] ; foreach ( $ mappings as $ entityClass => $ mapping ) { $ listeners = [ ] ; foreach ( $ mapping as $ listenerClass => $ listenerEvent ) { $ events = [ ] ; foreach ( $ listenerEvent as $ eventType => $ eventMapping ) { if ( $ eventMapping === null ) { $ eventMapping = [ null ] ; } foreach ( $ eventMapping as $ method ) { $ events [ ] = [ 'type' => $ eventType , 'method' => $ method , ] ; } } $ listeners [ ] = [ 'class' => $ listenerClass , 'event' => $ events , ] ; } $ entities [ ] = [ 'class' => $ entityClass , 'listener' => $ listeners , ] ; } return [ 'entities' => $ entities ] ; } ; $ node -> beforeNormalization ( ) // Yaml normalization -> ifTrue ( static function ( $ v ) { return is_array ( reset ( $ v ) ) && is_string ( key ( reset ( $ v ) ) ) ; } ) -> then ( $ normalizer ) -> end ( ) -> fixXmlConfig ( 'entity' , 'entities' ) -> children ( ) -> arrayNode ( 'entities' ) -> useAttributeAsKey ( 'class' ) -> prototype ( 'array' ) -> fixXmlConfig ( 'listener' ) -> children ( ) -> arrayNode ( 'listeners' ) -> useAttributeAsKey ( 'class' ) -> prototype ( 'array' ) -> fixXmlConfig ( 'event' ) -> children ( ) -> arrayNode ( 'events' ) -> prototype ( 'array' ) -> children ( ) -> scalarNode ( 'type' ) -> end ( ) -> scalarNode ( 'method' ) -> defaultNull ( ) -> end ( ) -> end ( ) -> end ( ) -> end ( ) -> end ( ) -> end ( ) -> end ( ) -> end ( ) -> end ( ) -> end ( ) -> end ( ) ; return $ node ; }
Return ORM entity listener node

@return NodeDefinition
Return ORM entity listener node