protected static function getClassFromCollection( array $collection )
    {
        // Make sure everything in this container is of __exactly__ the same type.
        // This is a stronger check than the entity container performs (child entities are ok in the container)
        $classes = array_unique( array_map( 'get_class', $collection ) );

        if( count( $classes ) > 1 ) {
            // TODO this could fallback to persisting every entity individually. That would work.
            throw new \Exception(
                sprintf(
                    "Can't manage entities in a container with multiple types, these are %s.",
                    implode( ", ", $classes )
                )
            );
        }
        return array_pop( $classes );

    }
protected static function getClassFromCollection( array $collection )
    {
        // Make sure everything in this container is of __exactly__ the same type.
        // This is a stronger check than the entity container performs (child entities are ok in the container)
        $classes = array_unique( array_map( 'get_class', $collection ) );

        if( count( $classes ) > 1 ) {
            // TODO this could fallback to persisting every entity individually. That would work.
            throw new \Exception(
                sprintf(
                    "Can't manage entities in a container with multiple types, these are %s.",
                    implode( ", ", $classes )
                )
            );
        }
        return array_pop( $classes );

    }
protected static function getClassFromCollection ( array $ collection ) { // Make sure everything in this container is of __exactly__ the same type. // This is a stronger check than the entity container performs (child entities are ok in the container) $ classes = array_unique ( array_map ( 'get_class' , $ collection ) ) ; if ( count ( $ classes ) > 1 ) { // TODO this could fallback to persisting every entity individually. That would work. throw new \ Exception ( sprintf ( "Can't manage entities in a container with multiple types, these are %s." , implode ( ", " , $ classes ) ) ) ; } return array_pop ( $ classes ) ; }
Check a collection only has one class. Determine this and return it.
@param array $collection
@return string
Check a collection only has one class . Determine this and return it .