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
0 answers

Doctrine Syntax Error

I keep getting the following error: QueryException: [Syntax Error] line 0, col 114: Error: Expected =, <, <=, <>, >, >=, !=, got '(' I tried using setParameter but I think its a problem with doctrine not support in query in sum? I know the…
2
votes
1 answer

Create database if not exists from DBAL level

I'm trying to create database like this: const QUERY_DB_CREATE = " CREATE DATABASE :db_name "; if (database is not exists) { $stmt = $conn->prepare(self::QUERY_DB_CREATE); $stmt->bindValue(':db_name', $db_name, 'string'); return…
2
votes
2 answers

Add Doctrine DBAL into own php project

Trying to add Doctrine DBAL into my own project to use it to access my db etc. I don't have composer and i never used it. This is what i am trying to do according to the docu: use Doctrine\Common\ClassLoader; class Connection { var…
BoA456
  • 341
  • 2
  • 15
2
votes
2 answers

symfony2.6 doctrine2 schema_filter parameter not exists

I am using symfony 2.6 (composer.json equal to its github repo) and I am trying to use the schema filter of DBAL. in config.yml # Doctrine Configuration doctrine: dbal: schema_filter: ^sf2_ but error returned on…
Raffaello
  • 1,641
  • 15
  • 29
2
votes
1 answer

Issues binding variable types using executeQuery in Doctrine DBAL

I'm looking to use the Doctrine DBAL function executeQuery as follows: $conn = DBAL\DriverManager::getConnection($connectionParams, $config); $sql = "SELECT count(*) FROM clients WHERE client_id = :id"; $results = $conn->executeQuery($sql, ['id'…
thodic
  • 2,229
  • 1
  • 19
  • 35
2
votes
1 answer

How to have doctrine dbal in symfony?

For some reasons I don't want my users to edit /app/config/config.php to add the database credentials, but in a separate file they add them as an array and my /app/config/config.php is PHP, not YAML nor XML, so how can I tell /app/config/config.php…
user4271704
  • 723
  • 1
  • 12
  • 37
2
votes
0 answers

Error occurred while closing statement in dbal

In my silex web aplication I have this function: function obtener_visible($conn, $articulo, $wid) { $q= $conn ->prepare('call vn2008.article_visible_single(?, ?)'); $q->execute(array(0 => $wid, 1=>$articulo)); $result =…
nelosan
  • 21
  • 1
  • 3
2
votes
2 answers

get doctrine db config in zf2

I want to use doctrine db config to access to DBAL layer in doctrine, I have the following configuration in my doctrine db file config: database.local.php return array( 'doctrine' => array( 'connection' => array( 'orm_default' => array( …
2
votes
1 answer

PHP Doctrine DBAL Schema Autoincrement doesn't work

I'm using Silex with Doctrine DBAL. I try to create a table: $schema = new \Doctrine\DBAL\Schema\Schema(); $table = $schema->createTable('admins'); $table->addColumn('id', 'smallint', array('unsigned' => true, 'autoincrement' =>…
Thomas K
  • 1,067
  • 1
  • 15
  • 35
2
votes
0 answers

Doctrine average from subquery

Does somebody have a suggestion how to compose the following query with the Querybuilder? The essence of the query; A Campsite can have multiple reviews, every review has a various number of numeric scores. The purpose of the query is to calculate…
Arjan
  • 416
  • 2
  • 4
2
votes
2 answers

Type mapping in Doctrine 2 DBAL

I am using only the DBAL part of Doctrine for my project. So I have to care over the mapping myself. I figured out that Doctrine remaps database types to a generic PHP type as you can read here [1]. Now I came across the fact that Doctrine maps the…
common sense
  • 3,775
  • 6
  • 22
  • 31
2
votes
2 answers

Symfony2 add new doctrine field type

i lost 3 hours on this thing, and still cant figure out whats wrong, iam trying to add a VARBINARY field type, and doctrine shows me that field as a option when generating new entity, but the problem is when i do php app/console…
michoni
  • 21
  • 3
2
votes
2 answers

Cannot bind string value in Doctrine DBAL using bindValue, Postgresql

I'm trying to use Doctrine DBAL in my project; my database is Postgresql. This is a simple use case and I really do not know why is this not working. $query = "SELECT * FROM table ORDER BY field :order LIMIT :amount"; Let's assume that: $order =…
Kamil
  • 221
  • 1
  • 2
  • 11
2
votes
2 answers

How to implement Complex SQL Query in Doctrine or ORM

I am using Symphony 2.3.3 and is new to Doctrine and ORM. I read a lot about doctrine entity manager, DBAL, DQL etc. I have the following query that I have built in SQL and now want to implement it by using any of the above methods i.e. easy…
Naveed Anwar
  • 186
  • 1
  • 8
2
votes
1 answer

Symfony2 Doctrine bundle constructor, what is the $typesconfig requirement they are asking for?

Hey guys I'm trying to port the ConnectionFactory class from the Symfony2 Doctrine2 bundle back into a stock installation of Doctrine2, but ran across a snag. The constructor requires an initialization array of $typesconfig on line 36. I briefly had…
ehime
  • 8,025
  • 14
  • 51
  • 110