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
2
votes
1 answer

Symfony2 Doctrine DBAL Wrapper Issue

I am trying to create a custom wrapper for a DBAL connection and have correctly setup the config.yml file, however I am getting the following error: DBALException: The given 'wrapperClass' Some\Bundle\Doctrine\DBAL\ExtendedConnection has to be a…
Scott Jones
  • 160
  • 3
  • 15
2
votes
1 answer

Getting the length of a column with Doctrine DBAL

I'm using the Doctrine DBAL project to get the length of the column in the table below (in this case the integer has a length of 8). I don't use the ORM and I don't have the schema defined in YML or anything. CREATE TABLE IF NOT EXISTS `mytable` ( …
user163588
  • 129
  • 1
  • 8
2
votes
2 answers

Doctrine DBAL and Oracle keywords

I'm using DBAL as standalone without ORM because I don't need it. However I have now some problems using oracle keywords in query. For instance I have the following code: $journal = array( 'LGM_ID' => 'SEQ_JOURNAL.NEXTVAL', …
2
votes
1 answer

Doctrine2 dbal cache subquery

I have a very expensive subquery that I use for multiple queries in my repository. I want to find a way to cache that subquery and use it's results in the other native sql queries. I am using the Doctrine2 DBAL in a symfony2 project. Native SQL is…
Roger
  • 145
  • 14
2
votes
2 answers

Symfony2 - Inject a service into SonataAdmin

I'd like to get a db connection from within a SonataAdmin class' configureFormFields() For sure this doesn't work protected function configureFormFields(FormMapper $formMapper) { $mycnx = $this->get('doctrine.dbal.mycnx_connection'); //... I…
Pierre de LESPINAY
  • 44,700
  • 57
  • 210
  • 307
1
vote
1 answer

Converting SQL to Doctrine DBAL or createQuery()

How can I rewrite this query to Doctrine DBAL query or better to createQuery() structure? When I used createQuery() "data_last" was not recognized as date but as string and generated errors. Maybe better solution would be internal left join and…
Paweł Madej
  • 1,229
  • 23
  • 42
1
vote
3 answers

Using Doctrine DBAL, how do I determine an update failure?

I am currently using Doctrine's DBAL library for MySQL interfacing and have currently built a structure around: public function update(array $data, $id) { return $this->db->update($this->table, $data, array('id' => $id)); } Which of course…
methodin
  • 6,717
  • 1
  • 25
  • 27
1
vote
1 answer

Clone Dbal Connection for doing Insert on Duplicate Get_Affected_Rows

I'm using Doctrine DBAL and wanting to do an INSERT ... ON DUPLICATE UPDATE where the return is affected_rows. Seems like you can't use the standard Dbal executeUpdate since INSERT ... ON DUPLICATE UPDATE and affected_rows are MySQL specific. That…
JustinP
  • 1,351
  • 1
  • 14
  • 29
1
vote
1 answer

Unknown column type when generating schema

I am developing an application using Symfony2 and Doctrine, the problem comes when I try to create tables for Role and User Entities using php app/console doctrine:schema:update --force, the relation is ManyToMany and although the mapping…
Haritz
  • 1,702
  • 7
  • 31
  • 50
1
vote
2 answers

PDO General Error using Doctrine DBAL in PPI Framework

I am receiving a 'HY000 General error' when running a prepared statement to UPDATE a table row. The query seems to run, and the row is updated successfully. My code and the error returned are detailed below. If anyone can point me in the right…
BenTheDesigner
  • 1,954
  • 3
  • 17
  • 21
1
vote
1 answer

How to keep-alive a Doctrine DBAL connection on a long-running process that is idle for hours awaiting input?

I have a long-running process, a symfony command that uses ReactPhp behind and lasts running for hours. If the DBAL $connection is not used, it breaks and the next time a request enters and is processed, it throws an exception. I am wondering if…
Xavi Montero
  • 9,239
  • 7
  • 57
  • 79
1
vote
2 answers

What are the beneifts of using a database abstraction layer?

I've been using some code that implements the phpBB DBAL for some time. Recently I had to implement a more full package around it and decided to use the DBAL throughout. In the main, it's been OK. But occassionally there are circumstances where I…
DavidM
  • 23
  • 4
1
vote
1 answer

How to preload classes in PHP in another namespace without using the class itself?

My models are inside the namespace App\Model. With composer auto-loading, they are only loaded when in use. But I want every class/interfaces/traits inside the App\Model to be preloaded to this script file (SchemaGenerator.php which is under App…
1
vote
1 answer

Is there any benefit in using parameters for query parameters that dont change?

I am writing methods in PHP classes that use QueryBuilder for the DBAL (Doctrine) ORM. One of the thing I like about this is that we can easily use parameters in the SQL that is generated. However, as I was working on a few queries and I notice that…
UnKulMunki
  • 15
  • 7
1
vote
2 answers

How can i make associations in Shopware 6?

Basically I want the same result that this SQL would return: SELECT id FROM property_group_option opt LEFT JOIN property_group_option_translation tra ON opt.id = tra.property_group_option_id WHERE opt.property_group_id = AND…
MweisIMI
  • 629
  • 3
  • 13