src/Graviton/DocumentBundle/DependencyInjection/Compiler/RecordOriginExceptionFieldsCompilerPass.php
public function process(ContainerBuilder $container)
    {
        $this->documentMap = $container->get('graviton.document.map');

        $map = [];
        foreach ($this->documentMap->getDocuments() as $document) {
            $recordOriginExceptionFields = $this->documentMap->getFieldNamesFlat(
                $document,
                '',
                '',
                function ($field) {
                    return $field->isRecordOriginException();
                }
            );

            if (!empty($recordOriginExceptionFields)) {
                foreach ($recordOriginExceptionFields as $key => $recordOriginExceptionField) {
                    if (substr($recordOriginExceptionField, -2) == '.0') {
                        unset($recordOriginExceptionFields[$key]);
                    }
                }

                $map[$document->getClass()] = array_values($recordOriginExceptionFields);
            }
        }

        $container->setParameter('graviton.document.recordoriginexception.fields', $map);
    }
public function process(ContainerBuilder $container)
    {
        $this->documentMap = $container->get('graviton.document.map');

        $map = [];
        foreach ($this->documentMap->getDocuments() as $document) {
            $recordOriginExceptionFields = $this->documentMap->getFieldNamesFlat(
                $document,
                '',
                '',
                function ($field) {
                    return $field->isRecordOriginException();
                }
            );

            if (!empty($recordOriginExceptionFields)) {
                foreach ($recordOriginExceptionFields as $key => $recordOriginExceptionField) {
                    if (substr($recordOriginExceptionField, -2) == '.0') {
                        unset($recordOriginExceptionFields[$key]);
                    }
                }

                $map[$document->getClass()] = array_values($recordOriginExceptionFields);
            }
        }

        $container->setParameter('graviton.document.recordoriginexception.fields', $map);
    }
public function process ( ContainerBuilder $ container ) { $ this -> documentMap = $ container -> get ( 'graviton.document.map' ) ; $ map = [ ] ; foreach ( $ this -> documentMap -> getDocuments ( ) as $ document ) { $ recordOriginExceptionFields = $ this -> documentMap -> getFieldNamesFlat ( $ document , '' , '' , function ( $ field ) { return $ field -> isRecordOriginException ( ) ; } ) ; if ( ! empty ( $ recordOriginExceptionFields ) ) { foreach ( $ recordOriginExceptionFields as $ key => $ recordOriginExceptionField ) { if ( substr ( $ recordOriginExceptionField , - 2 ) == '.0' ) { unset ( $ recordOriginExceptionFields [ $ key ] ) ; } } $ map [ $ document -> getClass ( ) ] = array_values ( $ recordOriginExceptionFields ) ; } } $ container -> setParameter ( 'graviton.document.recordoriginexception.fields' , $ map ) ; }
Make recordOriginException fields map and set it to parameter

@param ContainerBuilder $container container builder

@return void
Make recordOriginException fields map and set it to parameter