Coder Social home page Coder Social logo

Comments (4)

patrickbrouwers avatar patrickbrouwers commented on July 2, 2024

Hey Thomas,

Can you show us that part in the config?

Op donderdag 14 juli 2016 heeft Thomas Sieffert [email protected]
het volgende geschreven:

Hi,

I'm trying Fluent for a new project and I'm getting some trouble using
Fluent. When I try to use the $this->carbonDateTime('createdAt') method I
get this error :

DBALException in DBALException.php line 228:
Unknown column type "carbondatetime" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database introspection then you might have forgot to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information.

I have as dep laravel-doctrine/extensions, gedmo/doctrine-extensions and
beberlei/DoctrineExtensions and I added all references to Carbon class in
my doctrine.php config file as mentionned on the documentation. I also
tried to override the timestamps macro registering the one given in the
documentation in the boot method of a service provider which gave me no
more results.

If you have an idea :). Thanks !

My model :

id; } /_\* \* @return string _/ public function getNom() { return $this->nom; } /_\* \* @param string $nom \* \* @return Utilisateur */ public function setNom($nom) { $this->nom = $nom; return $this; }} and this is my mapping file : table('utilisateurs'); $builder->increments('id'); $builder->string('nom'); $builder->carbonDateTime('createdAt'); $builder->carbonDateTime('updatedAt'); $builder->entity()->setRepositoryClass(UtilisateurRepository::class); }} — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com//issues/39, or mute the thread https://github.com/notifications/unsubscribe/AHXr4TpMKDYB8J05v1Kqnw_t3DIPICsGks5qVqhcgaJpZM4JM3OY .

Patrick Brouwers__www.patrickbrouwersfilm.com
http://www.patrickbrouwersfilm.com

from fluent.

CaporalDead avatar CaporalDead commented on July 2, 2024

Yep, here it is :

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Entity Mangers
    |--------------------------------------------------------------------------
    |
    | Configure your Entity Managers here. You can set a different connection
    | and driver per manager and configure events and filters. Change the
    | paths setting to the appropriate path and replace App namespace
    | by your own namespace.
    |
    | Available meta drivers: fluent|annotations|yaml|xml|config|static_php|php
    |
    | Available connections: mysql|oracle|pgsql|sqlite|sqlsrv
    | (Connections can be configured in the database config)
    |
    | --> Warning: Proxy auto generation should only be enabled in dev!
    |
    */
    'managers'                   => [
        'default' => [
            'dev'           => env('APP_DEBUG'),
            'meta'          => env('DOCTRINE_METADATA', 'fluent'),
            'connection'    => env('DB_CONNECTION', 'mysql'),
            'mappings'      => [
                \App\Business\Mapping\UtilisateurMapping::class,
            ],
            'namespaces'    => [
                'App\Business\Entity',
            ],
            'paths'         => [
                base_path('app/Business/Mapping'),
            ],
            'repository'    => Doctrine\ORM\EntityRepository::class,
            'proxies'       => [
                'namespace'     => false,
                'path'          => storage_path('proxies'),
                'auto_generate' => env('DOCTRINE_PROXY_AUTOGENERATE', false)
            ],
            /*
            |--------------------------------------------------------------------------
            | Doctrine events
            |--------------------------------------------------------------------------
            |
            | The listener array expects the key to be a Doctrine event
            | e.g. Doctrine\ORM\Events::onFlush
            |
            */
            'events'        => [
                'listeners'   => [],
                'subscribers' => []
            ],
            'filters'       => [],
            /*
            |--------------------------------------------------------------------------
            | Doctrine mapping types
            |--------------------------------------------------------------------------
            |
            | Link a Database Type to a Local Doctrine Type
            |
            | Using 'enum' => 'string' is the same of:
            | $doctrineManager->extendAll(function (\Doctrine\ORM\Configuration $configuration,
            |         \Doctrine\DBAL\Connection $connection,
            |         \Doctrine\Common\EventManager $eventManager) {
            |     $connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
            | });
            |
            | References:
            | http://doctrine-orm.readthedocs.org/en/latest/cookbook/custom-mapping-types.html
            | http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html#custom-mapping-types
            | http://doctrine-orm.readthedocs.org/en/latest/cookbook/advanced-field-value-conversion-using-custom-mapping-types.html
            | http://doctrine-orm.readthedocs.org/en/latest/reference/basic-mapping.html#reference-mapping-types
            | http://symfony.com/doc/current/cookbook/doctrine/dbal.html#registering-custom-mapping-types-in-the-schematool
            |--------------------------------------------------------------------------
            */
            'mapping_types' => [
                //'enum' => 'string'
            ]
        ]
    ],
    /*
    |--------------------------------------------------------------------------
    | Doctrine Extensions
    |--------------------------------------------------------------------------
    |
    | Enable/disable Doctrine Extensions by adding or removing them from the list
    |
    | If you want to require custom extensions you will have to require
    | laravel-doctrine/extensions in your composer.json
    |
    */
    'extensions'                 => [
        //LaravelDoctrine\ORM\Extensions\TablePrefix\TablePrefixExtension::class,
        LaravelDoctrine\Extensions\Timestamps\TimestampableExtension::class,
        //LaravelDoctrine\Extensions\SoftDeletes\SoftDeleteableExtension::class,
        //LaravelDoctrine\Extensions\Sluggable\SluggableExtension::class,
        //LaravelDoctrine\Extensions\Sortable\SortableExtension::class,
        //LaravelDoctrine\Extensions\Tree\TreeExtension::class,
        //LaravelDoctrine\Extensions\Loggable\LoggableExtension::class,
        //LaravelDoctrine\Extensions\Blameable\BlameableExtension::class,
        //LaravelDoctrine\Extensions\IpTraceable\IpTraceableExtension::class,
        //LaravelDoctrine\Extensions\Translatable\TranslatableExtension::class
    ],
    /*
    |--------------------------------------------------------------------------
    | Doctrine custom types
    |--------------------------------------------------------------------------
    |
    | Create a custom or override a Doctrine Type
    |--------------------------------------------------------------------------
    */
    'custom_types'               => [
        'json'             => LaravelDoctrine\ORM\Types\Json::class,
        'CarbonDate'       => DoctrineExtensions\Types\CarbonDateType::class,
        'CarbonDateTime'   => DoctrineExtensions\Types\CarbonDateTimeType::class,
        'CarbonDateTimeTz' => DoctrineExtensions\Types\CarbonDateTimeTzType::class,
        'CarbonTime'       => DoctrineExtensions\Types\CarbonTimeType::class,
    ],
    /*
    |--------------------------------------------------------------------------
    | DQL custom datetime functions
    |--------------------------------------------------------------------------
    */
    'custom_datetime_functions'  => [],
    /*
    |--------------------------------------------------------------------------
    | DQL custom numeric functions
    |--------------------------------------------------------------------------
    */
    'custom_numeric_functions'   => [],
    /*
    |--------------------------------------------------------------------------
    | DQL custom string functions
    |--------------------------------------------------------------------------
    */
    'custom_string_functions'    => [],
    /*
    |--------------------------------------------------------------------------
    | Enable query logging with laravel file logging,
    | debugbar, clockwork or an own implementation.
    | Setting it to false, will disable logging
    |
    | Available:
    | - LaravelDoctrine\ORM\Loggers\LaravelDebugbarLogger
    | - LaravelDoctrine\ORM\Loggers\ClockworkLogger
    | - LaravelDoctrine\ORM\Loggers\FileLogger
    |--------------------------------------------------------------------------
    */
    'logger'                     => env('DOCTRINE_LOGGER', false),
    /*
    |--------------------------------------------------------------------------
    | Cache
    |--------------------------------------------------------------------------
    |
    | Configure meta-data, query and result caching here.
    | Optionally you can enable second level caching.
    |
    | Available: apc|array|file|memcached|redis|void
    |
    */
    'cache'                      => [
        'default'      => env('DOCTRINE_CACHE', 'array'),
        'namespace'    => null,
        'second_level' => false,
    ],
    /*
    |--------------------------------------------------------------------------
    | Gedmo extensions
    |--------------------------------------------------------------------------
    |
    | Settings for Gedmo extensions
    | If you want to use this you will have to require
    | laravel-doctrine/extensions in your composer.json
    |
    */
    'gedmo'                      => [
        'all_mappings' => false
    ],
    /*
     |--------------------------------------------------------------------------
     | Validation
     |--------------------------------------------------------------------------
     |
     |  Enables the Doctrine Presence Verifier for Validation
     |
     */
    'doctrine_presence_verifier' => true,
];

from fluent.

patrickbrouwers avatar patrickbrouwers commented on July 2, 2024

They key has to be lowercased, think it's a mistake in the config.

Op donderdag 14 juli 2016 heeft Thomas Sieffert [email protected]
het volgende geschreven:

Yep, here it is :

Warning: Proxy auto generation should only be enabled in dev! | */ 'managers' => [ 'default' => [ 'dev' => env('APP_DEBUG'), 'meta' => env('DOCTRINE_METADATA', 'fluent'), 'connection' => env('DB_CONNECTION', 'mysql'), 'mappings' => [ \App\Business\Mapping\UtilisateurMapping::class, ], 'namespaces' => [ 'App\Business\Entity', ], 'paths' => [ base_path('app/Business/Mapping'), ], 'repository' => Doctrine\ORM\EntityRepository::class, 'proxies' => [ 'namespace' => false, 'path' => storage_path('proxies'), 'auto_generate' => env('DOCTRINE_PROXY_AUTOGENERATE', false) ], /* |-------------------------------------------------------------------------- | Doctrine events |-------------------------------------------------------------------------- | | The listener array expects the key to be a Doctrine event | e.g. Doctrine\ORM\Events::onFlush | */ 'events' => [ 'listeners' => [], 'subscribers' => [] ], 'filters' => [], /* |-------------------------------------------------------------------------- | Doctrine mapping types |-------------------------------------------------------------------------- | | Link a Database Type to a Local Doctrine Type | | Using 'enum' => 'string' is the same of: | $doctrineManager->extendAll(function (\Doctrine\ORM\Configuration $configuration, | \Doctrine\DBAL\Connection $connection, | \Doctrine\Common\EventManager $eventManager) { | $connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); | }); | | References: | http://doctrine-orm.readthedocs.org/en/latest/cookbook/custom-mapping-types.html | http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html#custom-mapping-types | http://doctrine-orm.readthedocs.org/en/latest/cookbook/advanced-field-value-conversion-using-custom-mapping-types.html | http://doctrine-orm.readthedocs.org/en/latest/reference/basic-mapping.html#reference-mapping-types | http://symfony.com/doc/current/cookbook/doctrine/dbal.html#registering-custom-mapping-types-in-the-schematool |-------------------------------------------------------------------------- */ 'mapping_types' => [ //'enum' => 'string' ] ] ], /* |-------------------------------------------------------------------------- | Doctrine Extensions |-------------------------------------------------------------------------- | | Enable/disable Doctrine Extensions by adding or removing them from the list | | If you want to require custom extensions you will have to require | laravel-doctrine/extensions in your composer.json | */ 'extensions' => [ //LaravelDoctrine\ORM\Extensions\TablePrefix\TablePrefixExtension::class, LaravelDoctrine\Extensions\Timestamps\TimestampableExtension::class, //LaravelDoctrine\Extensions\SoftDeletes\SoftDeleteableExtension::class, //LaravelDoctrine\Extensions\Sluggable\SluggableExtension::class, //LaravelDoctrine\Extensions\Sortable\SortableExtension::class, //LaravelDoctrine\Extensions\Tree\TreeExtension::class, //LaravelDoctrine\Extensions\Loggable\LoggableExtension::class, //LaravelDoctrine\Extensions\Blameable\BlameableExtension::class, //LaravelDoctrine\Extensions\IpTraceable\IpTraceableExtension::class, //LaravelDoctrine\Extensions\Translatable\TranslatableExtension::class ], /* |-------------------------------------------------------------------------- | Doctrine custom types |-------------------------------------------------------------------------- | | Create a custom or override a Doctrine Type |-------------------------------------------------------------------------- */ 'custom_types' => [ 'json' => LaravelDoctrine\ORM\Types\Json::class, 'CarbonDate' => DoctrineExtensions\Types\CarbonDateType::class, 'CarbonDateTime' => DoctrineExtensions\Types\CarbonDateTimeType::class, 'CarbonDateTimeTz' => DoctrineExtensions\Types\CarbonDateTimeTzType::class, 'CarbonTime' => DoctrineExtensions\Types\CarbonTimeType::class, ], /* |-------------------------------------------------------------------------- | DQL custom datetime functions |-------------------------------------------------------------------------- */ 'custom_datetime_functions' => [], /* |-------------------------------------------------------------------------- | DQL custom numeric functions |-------------------------------------------------------------------------- */ 'custom_numeric_functions' => [], /* |-------------------------------------------------------------------------- | DQL custom string functions |-------------------------------------------------------------------------- */ 'custom_string_functions' => [], /* |-------------------------------------------------------------------------- | Enable query logging with laravel file logging, | debugbar, clockwork or an own implementation. | Setting it to false, will disable logging | | Available: | - LaravelDoctrine\ORM\Loggers\LaravelDebugbarLogger | - LaravelDoctrine\ORM\Loggers\ClockworkLogger | - LaravelDoctrine\ORM\Loggers\FileLogger |-------------------------------------------------------------------------- */ 'logger' => env('DOCTRINE_LOGGER', false), /* |-------------------------------------------------------------------------- | Cache |-------------------------------------------------------------------------- | | Configure meta-data, query and result caching here. | Optionally you can enable second level caching. | | Available: apc|array|file|memcached|redis|void | */ 'cache' => [ 'default' => env('DOCTRINE_CACHE', 'array'), 'namespace' => null, 'second_level' => false, ], /* |-------------------------------------------------------------------------- | Gedmo extensions |-------------------------------------------------------------------------- | | Settings for Gedmo extensions | If you want to use this you will have to require | laravel-doctrine/extensions in your composer.json | */ 'gedmo' => [ 'all_mappings' => false ], /* |-------------------------------------------------------------------------- | Validation |-------------------------------------------------------------------------- | | Enables the Doctrine Presence Verifier for Validation | */ 'doctrine_presence_verifier' => true, ``` ]; — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com//issues/39#issuecomment-232797107, or mute the thread https://github.com/notifications/unsubscribe/AHXr4V8FUfmN7p8Ckc97Cs9QDOiC4s9bks5qVqkvgaJpZM4JM3OY .

Patrick Brouwers__www.patrickbrouwersfilm.com
http://www.patrickbrouwersfilm.com

from fluent.

CaporalDead avatar CaporalDead commented on July 2, 2024

Yep, that was it, it's a typo in the documentation, I'll do a PR to fix that :). Thanks !

from fluent.

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.