Questions tagged [dbal]

Database Abstraction Layer for Doctrine ORM (PHP)

Database abstraction layer with many features for database schema introspection, schema management and PDO abstraction.

261 questions
3
votes
1 answer

Double Results for a SQL Update Statement

I've been scratching my head with this for a couple of hours already... This is what's going on: I run this statement SELECT STATUS FROM [dbo].[TMP_TEST_CALL_LIST] where identity = '659303186000000000' and I get the following result (a…
Amarundo
  • 2,357
  • 15
  • 50
  • 68
3
votes
2 answers

Symfony 6 + Doctrine - How to configure Doctrine\DBAL\Driver\OCI8\Middleware\InitializeSession?

The Doctrine\DBAL\Event\Listeners\OracleSessionInit was deprecated in DBAL 3.5 (https://github.com/doctrine/dbal/blob/3.5.x/UPGRADE.md) in favor of the Doctrine\DBAL\Driver\OCI8\Middleware\InitializeSession. How should I setup the application with a…
Petr F
  • 43
  • 3
3
votes
2 answers

Doctrine DBAL Transactions

I don't really understand how to do transactions in DBAL I have the following script going which updates a column depending on the id of the row. I put a fake id which doesn't exists in the table, (therefore making an update unable to occur) but the…
Mallow
  • 844
  • 1
  • 13
  • 37
3
votes
3 answers

How to use Doctrine DBAL?

I have this folder structure [-] myapp/ [+] app/ [-] lib/ [-] vendor/ [-] doctrine/ [-] Doctrine/ Common/ DBAL/ Symfony/ …
Permana
  • 1,972
  • 2
  • 33
  • 51
3
votes
1 answer

PostgreSQL: Not null violation: 7 ERROR: null value in column "id" violates not-null constraint

doctrine /** * @var integer $id * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @var string $entity * *…
Vidy Videni
  • 1,897
  • 3
  • 15
  • 23
3
votes
0 answers

How to fix a syntax error on symfony component raised after composer require doctrine/dbal?

PLEASE READ BEFORE MARKED IT AS DUPLICATE, because I did not write the symphony code. A syntax error was raised after I added the following library: composer require doctrine/dbal. This only happens on production and not on local env. Im getting the…
Jacobo
  • 1,259
  • 2
  • 19
  • 43
3
votes
1 answer

Doctrine 2 - How to update schema with new enum values?

Following Doctrine 2's enum defining a type guide, I have the following class: class EnumStatusType extends EnumType { protected $name = 'enumStatusType'; protected $values = [ 'active', ]; } Now, using…
Christopher Francisco
  • 15,672
  • 28
  • 94
  • 206
3
votes
2 answers

PHP - Connecting to heroku PostGres database from localhost (on Windows)

I'm trying to work with a PostGres database hosted on heroku, I need to connect to it from my local machine. Heres an example of the credentials I'm using: params: driver: pdo_pgsql host: e5-31-281-414-28.compute-1.amazonaws.com dbname:…
Horse O'Houlihan
  • 1,659
  • 4
  • 14
  • 29
3
votes
1 answer

Use Doctrine with REST APIs

Is it possible to use a REST API as Doctrine database? Regarding the configuration on http://doctrine-orm.readthedocs.org/projects/doctrine-dbal/en/latest/reference/configuration.html I can change the "driver" property. But in the list of allowed…
J. Doe
  • 43
  • 1
  • 5
3
votes
1 answer

How to use DBAL query builder to build this subquery?

I have this query with subquery. SELECT * FROM (SELECT module_id FROM an_modules AS m LIMIT 20 OFFSET 0) AS m LEFT JOIN an_module_sites AS ms ON (m.module_id = ms.module_id) How to use DBAL to build subquery like this? This doesn't seem to be…
vee
  • 4,506
  • 5
  • 44
  • 81
3
votes
1 answer

Doctrine DBAL Insert if doesn't exist

I'm using Symfony2-framework with Doctrine DBAL, and I'm inserting some data into MySql-database. Insert looks something like this(simplified): $conn->insert('sometable', array( "col1" => $data1, "col2" => $data2, …
GotBatteries
  • 1,346
  • 1
  • 19
  • 28
3
votes
0 answers

Making a dependency configurable at runtime in Symfony 2?

In my reusable bundle, I can specify a connection name (Doctrine DBAL connection): # config.yml my_bundle: connection: ~ # or "default", or "my_connection" In the extension, I'm aliasing it: // MyBundleExtension.php $container->setAlias( …
gremo
  • 47,186
  • 75
  • 257
  • 421
3
votes
2 answers

How to select the connection to database when I use console in symfony2

I have two databases, (MySQL and Oracle), I did the connection betweek sf2 and both databases, here is my config.yml file: doctrine: dbal: default_connection: default connections: default: driver: "%database_driver%" …
user3303133
  • 105
  • 1
  • 10
3
votes
2 answers

DBAL Connection to database from Entity in Symfony2

I have created this Entity : id = $id; } public function setName($name) { $sql = "UPDATE users SET name=:name…
lepix
  • 4,992
  • 6
  • 40
  • 53
3
votes
4 answers

List of strings in prepared statement using Doctrine DBAL

Following the Doctrine DBAL documentation I should be able to bind a list of string values like this: $sql = 'SELECT * FROM mytable WHERE myfield IN (?)'; $stmt = $conn->prepare($sql); $stmt->bindValue('myfield', array('stringa', 'stringb',…
Bram Gerritsen
  • 7,178
  • 4
  • 35
  • 45