Comments (4)
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.
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.
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.
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)
- $builder->string('name')->index(); returns an error HOT 3
- The oneToOne relation not exist joinColumn method HOT 6
- findOneBy() and findBy() not working with embedded fields HOT 2
- Access custom types in Mappings HOT 2
- Primary Key by Embeddable Value HOT 3
- Add a boot method to the Mappings HOT 3
- Cannot use enum column type HOT 3
- Null object relationship with builder HOT 1
- hasOne / belongsTo mapping fails schema validation HOT 8
- JSONB option being ignored HOT 1
- How to escape reserved words with Fluent mappping? HOT 2
- Using unique causes a specified key too long exception HOT 2
- Index method not obeying columName() it tries to create the index using the field name instead
- Composer Dependency Issues on Installation HOT 2
- Does this package depend on laravel framework or its components? HOT 1
- Add hardDelete option for softDeleteable fields
- FluentDriver use error with Laravel 8 HOT 2
- doctrine/orm version bump HOT 6
- [Help] How to mapping many-to-many relationships and accessing intermediate table HOT 2
- Support for Laravel 10 - doctrine/persistence upgrade to ^3?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fluent.