Giter Site home page Giter Site logo

Comments (1)

goetas avatar goetas commented on June 14, 2024

From my understanding of mapping types, types and comments...

  • mapping_types are rules used by DBAL to convert SQL types to DBAL types.
  • types are rules used by DBAL to convert DBAL types into PHP Types (or better, to choose a converter that maps "SQL data" to PHP types/data).

as example:

  • postgres bigserial is converted into DBAL's bigint (thanks to built in mapping_types)
  • DBAL's bigint is later converted in PHP's string (thanks to built in types)

Thus in your case i would expect something as:

        mapping_types:
            vector: LLPhantVectorType
        types:
            LLPhantVectorType: LLPhant\Embeddings\VectorStores\Doctrine\VectorType

The fact that your implementation of VectorType returns an array is is unknown to doctrine.

The comment is used to infer a Doctrine type when there are multiple doctrine types mapped on the same SQL type. The classical example is:

Consider an SQL type varchar(255), that type can be used as the Php's string, MyEnum (a backed enum that uses strings as cases) or any PHP type that can be serialized into a string with max 255 chrs.

When DBAL encounters a vector SQL type, needs to decide which DBAL Type assign to it. If a comment is found, it will try to find that type, if not it will find a default.

You might have configs defined as follows:

        mapping_types:
            vector: LLPhantVectorType
        types:
            LLPhantVectorType: LLPhant\Embeddings\VectorStores\Doctrine\VectorType
            GoetasVectorType: GoetasVectorType

In this case, both GoetasVectorType and LLPhant\Embeddings\VectorStores\Doctrine\VectorType want to use a SQL vector, but DBAL needs to a way to decide which type to instantaite when an SQL column of type vector is found.

GoetasVectorType will have to override requiresSQLCommentHint. Columns that use GoetasVectorType will have a comment, columns that use LLPhant\Embeddings\VectorStores\Doctrine\VectorType will not.

When DBAL finds an SQL vector type will check for a comment, when found will try to instantiate the type in the comment. If no comment is found, will try to instantiate the type defined in the configs.

from doctrinemigrationsbundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.