Comments (6)
objects and array column types are unfortunately currently not supported at crate-pdo
.
we'll try to add this feature asap and will notify you.
btw. json_encode the map would be wrong anyway because this would result in a json string.
from crate-dbal.
Any thoughts on how it will work when it's done? Do the object and map type work at ORM level?
from crate-dbal.
fixed through 7d6e95f.
I've released 0.0.4 just now.
In your example, following should work now (note the list of data types argument):
$conn->insert('items', [
$conn->quoteIdentifier('object_column') => [
'id' => 1,
'name' => 'inner object test'
]
], [\Crate\PDO\PDO::PARAM_OBJECT]);
from crate-dbal.
unfortunately it doesn't work, I get the following exception:
DBALException: An exception occurred while executing 'INSERT INTO items ("object_column") VALUES (?)' with params [{"id":1,"name":"inner object test"}]:
SQLActionException[Column 'object_column.id' unknown]
I'm on doctrine/dbal 2.3.5 and crate/crate-dbal 0.0.4
update: the insert does work when I set the object_column to DYNAMIC instead of STRICT
from crate-dbal.
hm you're right, the table creation does not work properly, it does not create the map's sub-columns.
will check this.
meanwhile you could work around it by defining the map column type as \Crate\DBAL\Types\MapType::DYNAMIC, so unknown map keys will be created dynamically while inserting.
from crate-dbal.
after I reproduced your problem, I've found the issue:
sub-columns of a MapType
must be declared under the name fields
not data
.
so this map column declaration will work:
$objDefinition = array(
'type' => \Crate\DBAL\Types\MapType::STRICT,
'fields' => array(
new \Doctrine\DBAL\Schema\Column('id', \Doctrine\DBAL\Types\Type::getType('integer'), array()),
new \Doctrine\DBAL\Schema\Column('name', \Doctrine\DBAL\Types\Type::getType('string'), array()),
),
);
from crate-dbal.
Related Issues (20)
- test
- Add compatibility with PHP 8.0 HOT 5
- Add compatibility with Doctrine DBAL 3.x and 4.x HOT 1
- Check if CrateDB DBAL can be used with PostgreSQL PDO instead of CrateDB PDO
- Incompatibility to current doctrine/dbal 2.13.* HOT 2
- Locking dependencies HOT 6
- Unable to install via composer HOT 2
- Doctrine DBAL version problem with Symfony2 HOT 1
- BOOLEAN support for Crate-DBAL HOT 3
- PHP 7 support HOT 2
- UNIQUE handling HOT 2
- Not compatible with 2.3.5 HOT 3
- Latest DBAL v. 0.3.1 not compatible with Crate.io v. 2.3 HOT 1
- Flush functionality HOT 3
- How to define number of shards and replicas? HOT 7
- DBAL 2.10 HOT 1
- How to get number of shards and replicas? HOT 3
- upgrade docs build system HOT 5
- How to get column options
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 crate-dbal.