Questions tagged [doctrine-dbal]
The doctrine-dbal tag has no usage guidance.
22
questions
0
votes
0
answers
17
views
Variable declaration in Doctrine [duplicate]
Is it possible to do something like this in Doctrine?
SET @somevariable=null;
I am currently doing the following:
$query = <<<SQL
SELECT * FROM table;
SQL;
$iterator = new ...
4
votes
2
answers
561
views
Change primary key in Laravel migration with SQLite
I have the following migration:
Schema::create('items', function(Blueprint $table) {
$table->uuid('id')->primary();
// more columns ...
});
Now, we want to add an additional auto-...
0
votes
0
answers
17
views
PHP - composer update doctrine/dbal to specific version [duplicate]
I want to be able to update all dependencies, but most importantly I want first to upgrade doctrine/dbal package.
Current version is 2.13.2 and I tried to update it first with composer update to 2....
-2
votes
1
answer
151
views
Configure Symfony 3rd party bundle with container parameters declared in custom container extension / compiler pass
I want to configure the Doctrine bundle to have a DBAL connection. For some reason the configuration needs a bit of logic to retrieve. I tried to use a container extension and then a compiler pass to ...
1
vote
2
answers
218
views
How is it possible to map column names from a Doctrine sql query?
I created a query with query builder like this:
$qb = $em->createQueryBuilder();
$qb->select(['u.id', 'u.name'])
->from(User::class, 'u')
->where('u.active = 1')
;
$sql = $qb->...
0
votes
1
answer
964
views
Doctrine DBAL 2.13 $statement->execute() returns bool (instead of Result)
Since the release of Doctrine DBAL 2.13 deprecations have been added as stated here.
While the old way of fetching results is something like this:
$statement->execute();
while (($row = $statement-&...
3
votes
1
answer
2k
views
alternative for doctrine deprecated ping()
Doctrine\DBAL\Connection::ping()
is marked as @deprecated
I found this commit that introduced it but no info about successor for this method was given.
I would like to know what is expected ...
0
votes
2
answers
529
views
TYPO3: Using IS NULL and COALESCE in OrderBy with TYPO3 Querybuilder
I want to using the query
SELECT `uid` FROM `machines` ORDER BY NOT ISNULL(`changed`),`changed` DESC
in my controller .
For this I use the querybuilder like this:
$queryBuilder = GeneralUtility::...
22
votes
1
answer
12k
views
How to fetch results into a custom object now that fetchAll() and FetchMode are deprecated?
On some existing code I have the following statement (after a rather long query building exercise):
return $statement->fetchAll(
DBAL\FetchMode::CUSTOM_OBJECT,
PublishedLead::class
);
This ...
0
votes
1
answer
581
views
Doctrine DBAL, diff command and enum type
I am working with symfony 5.1, doctrine-bundle 2.1.2 and doctrine-migrations-bundle 2.2. I am NOT working with ORM and define my own Schemas. To add Enum types, I am using the following code:
abstract ...
0
votes
1
answer
223
views
How to change nullable columns to having default values in Laravel?
I want to change some table columns in Laravel from nullable to having a default value. I installed doctrine/dbal, and created a new migration with the following columns I want to change (previously ...
0
votes
1
answer
134
views
Doctorine/Dbal - Update table migration adding unwanted "Auto Increment" on integer (not increments)
I'm using Laravel 6.6.0 and Doctrine/Dbal 2.10.
I need to update a migration, and have followed the info in the docs.
I have a small unsigned non-auto-incrementing integer which I need to change to an ...
0
votes
1
answer
413
views
TYPO3 throws exception when using unqoted named param
I'm trying to execute a raw query with a prepared statement in PDO-like style using unquoted params (cases 1, 1A), anyway it throws an exception:
An exception occurred while executing 'SELECT * FROM ...
1
vote
0
answers
317
views
Doctrine MasterSlaveConnection with empty env-vars
# doctrine.yaml
parameters:
# Adds a fallback DATABASE_URL if the env var is not set.
# This allows you to run cache:warmup even if your
# environment variables are not available yet.
#...
1
vote
3
answers
2k
views
TYPO3 QueryBuilder - how to find the most recent record for a user?
This is a really obvious data problem, but I can't find a simple solution anywhere.
Using TYPO3 QueryBuilder, how do you select the most recent entry for each user from a table that has multiple ...
2
votes
2
answers
318
views
Prooph Eventstore (PDO) and Doctrine DBAL results in multiple connections
Situation
I'm using Prooph for my commandbus, eventbus and eventstore within Symfony 4.3. Since not every aggregate needs to be eventsourced, we also use Doctrine DBAL to just simply CRUD those ...
0
votes
1
answer
535
views
How to Fix Unknown Database Error When Migrate Database Using Doctrine/DBAL?
I tried to make a POS system in migration relationship. I used Doctrine/DBAL before running migrate for making the relationship. After installing Doctrine/DBAL when I run migrate an unknown database ...
1
vote
1
answer
4k
views
Saving Date field with doctrine
In my application I save data with doctrine to an mysql database.
for me it is totally sufficient to save the date and not also the time therefore I have chosen the Date format for my database field.
...
1
vote
1
answer
1k
views
Doctrine: Hydrate models from raw SQL
I have the following custom query. I know its a simple one, so it can also be used as a DQL, but I have more complex ones too. But I want to know the way, how to do it even with more complex queries.
...
0
votes
1
answer
178
views
Symfony - addHaving - concat + regexp
Raw query:
select firstfield, secondfield, phone_number, thirdfield
from table
having CONCAT(firstfield, ' ', secondfield, ' ', thirdfield, ' ', fourthfield) regexp 'value'
and CONCAT(...
7
votes
1
answer
8k
views
Incorrect mapping of mysql tinyint(2) as boolean with doctrine
I reverse engineered my database with symfony2 and doctrine with commands :
php app/console doctrine:mapping:convert
php app/console doctrine:mapping:import
php app/console doctrine:generate:entities
...
40
votes
3
answers
23k
views
What is the difference between Database Abstraction Layer & Data Access Layer?
I am actually stuck in 3-tier structure. I surfed the internet and found two terminologies "Database Abstraction Layer" & "Data Access Layer".
What are the differences between the two?