|
9 | 9 |
|
10 | 10 | abstract class PgvectorSetup |
11 | 11 | { |
12 | | - public static function register(EntityManager $entityManager): void |
| 12 | + public static function registerTypes(?EntityManager $entityManager): void |
13 | 13 | { |
14 | | - self::registerTypes(); |
15 | | - self::registerPlatformTypes($entityManager->getConnection()->getDatabasePlatform()); |
16 | | - self::registerFunctions($entityManager->getConfiguration()); |
| 14 | + self::addTypes(); |
| 15 | + self::registerTypeMapping($entityManager->getConnection()->getDatabasePlatform()); |
| 16 | + self::addFunctions($entityManager->getConfiguration()); |
17 | 17 | } |
18 | 18 |
|
19 | | - private static function registerTypes(): void |
| 19 | + private static function addTypes(): void |
20 | 20 | { |
21 | 21 | Type::addType('vector', 'Pgvector\Doctrine\VectorType'); |
22 | 22 | Type::addType('halfvec', 'Pgvector\Doctrine\HalfVectorType'); |
23 | 23 | Type::addType('bit', 'Pgvector\Doctrine\BitType'); |
24 | 24 | Type::addType('sparsevec', 'Pgvector\Doctrine\SparseVectorType'); |
25 | 25 | } |
26 | 26 |
|
27 | | - private static function registerPlatformTypes(AbstractPlatform $platform): void |
| 27 | + private static function registerTypeMapping(AbstractPlatform $platform): void |
28 | 28 | { |
29 | 29 | $platform->registerDoctrineTypeMapping('vector', 'vector'); |
30 | 30 | $platform->registerDoctrineTypeMapping('halfvec', 'halfvec'); |
31 | 31 | $platform->registerDoctrineTypeMapping('bit', 'bit'); |
32 | 32 | $platform->registerDoctrineTypeMapping('sparsevec', 'sparsevec'); |
33 | 33 | } |
34 | 34 |
|
35 | | - private static function registerFunctions(Configuration $config): void |
| 35 | + private static function addFunctions(Configuration $config): void |
36 | 36 | { |
37 | 37 | $config->addCustomNumericFunction('l2_distance', 'Pgvector\Doctrine\L2Distance'); |
38 | 38 | $config->addCustomNumericFunction('max_inner_product', 'Pgvector\Doctrine\MaxInnerProduct'); |
|
0 commit comments