private function processEntityPropertiesMetadata(ClassMetadata $entityMetadata)
    {
        $entityPropertiesMetadata = [];

        if ($entityMetadata->isIdentifierComposite) {
            throw new \RuntimeException(\sprintf("The '%s' entity isn't valid because it contains a composite primary key.", $entityMetadata->name));
        }

        // introspect regular entity fields
        foreach ($entityMetadata->fieldMappings as $fieldName => $fieldMetadata) {
            $entityPropertiesMetadata[$fieldName] = $fieldMetadata;
        }

        // introspect fields for entity associations
        foreach ($entityMetadata->associationMappings as $fieldName => $associationMetadata) {
            $entityPropertiesMetadata[$fieldName] = \array_merge($associationMetadata, [
                'type' => 'association',
                'associationType' => $associationMetadata['type'],
            ]);

            // associations different from *-to-one cannot be sorted
            if ($associationMetadata['type'] & ClassMetadata::TO_MANY) {
                $entityPropertiesMetadata[$fieldName]['sortable'] = false;
            }
        }

        return $entityPropertiesMetadata;
    }
private function processEntityPropertiesMetadata(ClassMetadata $entityMetadata)
    {
        $entityPropertiesMetadata = [];

        if ($entityMetadata->isIdentifierComposite) {
            throw new \RuntimeException(\sprintf("The '%s' entity isn't valid because it contains a composite primary key.", $entityMetadata->name));
        }

        // introspect regular entity fields
        foreach ($entityMetadata->fieldMappings as $fieldName => $fieldMetadata) {
            $entityPropertiesMetadata[$fieldName] = $fieldMetadata;
        }

        // introspect fields for entity associations
        foreach ($entityMetadata->associationMappings as $fieldName => $associationMetadata) {
            $entityPropertiesMetadata[$fieldName] = \array_merge($associationMetadata, [
                'type' => 'association',
                'associationType' => $associationMetadata['type'],
            ]);

            // associations different from *-to-one cannot be sorted
            if ($associationMetadata['type'] & ClassMetadata::TO_MANY) {
                $entityPropertiesMetadata[$fieldName]['sortable'] = false;
            }
        }

        return $entityPropertiesMetadata;
    }
private function processEntityPropertiesMetadata ( ClassMetadata $ entityMetadata ) { $ entityPropertiesMetadata = [ ] ; if ( $ entityMetadata -> isIdentifierComposite ) { throw new \ RuntimeException ( \ sprintf ( "The '%s' entity isn't valid because it contains a composite primary key." , $ entityMetadata -> name ) ) ; } // introspect regular entity fields foreach ( $ entityMetadata -> fieldMappings as $ fieldName => $ fieldMetadata ) { $ entityPropertiesMetadata [ $ fieldName ] = $ fieldMetadata ; } // introspect fields for entity associations foreach ( $ entityMetadata -> associationMappings as $ fieldName => $ associationMetadata ) { $ entityPropertiesMetadata [ $ fieldName ] = \ array_merge ( $ associationMetadata , [ 'type' => 'association' , 'associationType' => $ associationMetadata [ 'type' ] , ] ) ; // associations different from *-to-one cannot be sorted if ( $ associationMetadata [ 'type' ] & ClassMetadata :: TO_MANY ) { $ entityPropertiesMetadata [ $ fieldName ] [ 'sortable' ] = false ; } } return $ entityPropertiesMetadata ; }
Takes the entity metadata introspected via Doctrine and completes its
contents to simplify data processing for the rest of the application.

@param ClassMetadata $entityMetadata The entity metadata introspected via Doctrine

@return array The entity properties metadata provided by Doctrine

@throws \RuntimeException
Takes the entity metadata introspected via Doctrine and completes its contents to simplify data processing for the rest of the application .