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

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

            $finalRestrictionFields = [];
            foreach ($restrictionFields as $key => $field) {
                // cleanup name! .0. has to be .. for rql!
                $key = preg_replace('@\.([0-9]+)\.@i', '..', $key);
                $finalRestrictionFields[$key] = $field->getRestrictions();
            }

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

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

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

            $finalRestrictionFields = [];
            foreach ($restrictionFields as $key => $field) {
                // cleanup name! .0. has to be .. for rql!
                $key = preg_replace('@\.([0-9]+)\.@i', '..', $key);
                $finalRestrictionFields[$key] = $field->getRestrictions();
            }

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

        $container->setParameter('graviton.document.restriction.fields', $map);
    }
public function process ( ContainerBuilder $ container ) { $ this -> documentMap = $ container -> get ( 'graviton.document.map' ) ; $ map = [ ] ; foreach ( $ this -> documentMap -> getDocuments ( ) as $ document ) { $ restrictionFields = $ this -> documentMap -> getFieldNamesFlat ( $ document , '' , '' , function ( $ field ) { return $ field -> getRestrictions ( ) ; } , true ) ; $ finalRestrictionFields = [ ] ; foreach ( $ restrictionFields as $ key => $ field ) { // cleanup name! .0. has to be .. for rql! $ key = preg_replace ( '@\.([0-9]+)\.@i' , '..' , $ key ) ; $ finalRestrictionFields [ $ key ] = $ field -> getRestrictions ( ) ; } $ map [ $ document -> getClass ( ) ] = $ finalRestrictionFields ; } $ container -> setParameter ( 'graviton.document.restriction.fields' , $ map ) ; }
prepare a map of base data restrictions for Restriction\Manager

@param ContainerBuilder $container container builder

@return void
prepare a map of base data restrictions for Restriction \ Manager