public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
    {
        $classMetadata = $eventArgs->getClassMetadata();

        if (null === $classMetadata->reflClass) {
            return;
        }

        if ($this->isGeocodable($classMetadata)) {
            if (!Type::hasType('point')) {
                Type::addType('point', 'Knp\DoctrineBehaviors\DBAL\Types\PointType');
            }

            $em = $eventArgs->getEntityManager();
            $con = $em->getConnection();

            // skip non-postgres platforms
            if (!$con->getDatabasePlatform() instanceof PostgreSqlPlatform &&
                !$con->getDatabasePlatform() instanceof MySqlPlatform
            ) {
                return;
            }

            // skip platforms with registerd stuff
            if (!$con->getDatabasePlatform()->hasDoctrineTypeMappingFor('point')) {

                $con->getDatabasePlatform()->registerDoctrineTypeMapping('point', 'point');

                if ($con->getDatabasePlatform() instanceof PostgreSqlPlatform) {
                    $em->getConfiguration()->addCustomNumericFunction(
                        'DISTANCE',
                        'Knp\DoctrineBehaviors\ORM\Geocodable\Query\AST\Functions\DistanceFunction'
                    );
                }
            }

            $classMetadata->mapField(
                [
                    'fieldName' => 'location',
                    'type'      => 'point',
                    'nullable'  => true
                ]
            );
        }
    }