Questions tagged [doctrine]

The Doctrine Project is a collection of open source libraries and tools for dealing with database abstraction and Object-Relational Mapping written in PHP.

The Doctrine Project is a collection of open source libraries and tools for dealing with database abstraction and Object-Relational Mapping written in PHP.


Doctrine 2

When we say Doctrine 2 it usually refers to Doctrine ORM Project. The ORM sits on top of the database abstraction layer (called DBAL). It also uses Doctrine Common (which provides extensions to core PHP functionality).

Side projects

Then you have side projects dedicated to some DBMS which provide transparent persistence for PHP objects:

Documentation

Useful links


Doctrine 1

The first version doesn't have a separate project for the relational mapper and the database abstraction layer. It requires PHP 5.2.3+ and the latest version is 1.2.5.

11930 questions
49
votes
7 answers

Symfony: Clear doctrine cache

I need to clear my doctrine's cache in Symfony. There must be some way in command line for clear the cache. Or where should I find and delete the files belonging to cache?
morteza kavakebi
  • 1,640
  • 3
  • 18
  • 39
46
votes
4 answers

Symfony 2: INNER JOIN on non related table with doctrine query builder

I'm trying to build a query with the doctrine query builder which joins a non related table like this: $query = $this->createQueryBuilder('gpr') ->select('gpr, p') ->innerJoin('TPost', 'p') ->where('gpr.contentId =…
0s1r1s
  • 1,723
  • 1
  • 13
  • 15
45
votes
5 answers

pass array of conditions to doctrine expr()->orx() method

I need to construct DQL with a QueryBuilder like this [QUERY]... AND WHERE e.type = x OR e.type = Y OR e.type = N [...] I have types in array How can I pass this array to my query builder? $qb->andWhere($qb->expr()->orx(CONDITIONS)); List of…
Bartosz Rychlicki
  • 1,918
  • 3
  • 20
  • 41
44
votes
7 answers

Symfony2 $user->setPassword() updates password as plain text [DataFixtures + FOSUserBundle]

I'm trying to pre-populate a database with some User objects, but when I call $user->setPassword('some-password'); and then save the user object, the string 'some-password' is stored directly in the database, instead of the hashed+salted…
Rodney Folz
  • 6,709
  • 2
  • 29
  • 38
44
votes
5 answers

Cannot autowire service: Argument references class but no such service exists

I'm upgrading a project from Symfony 3 to Symfony 4 (https://github.com/symfony/symfony/blob/master/UPGRADE-4.0.md) and I have many repository/services like this: namespace App\Entity; use App\Entity\Activation; use…
Donal.Lynch.Msc
  • 3,365
  • 12
  • 48
  • 78
44
votes
6 answers

Using Raw SQL with Doctrine

I have some extremely complex queries that I need to use to generate a report in my application. I'm using symfony as my framework and doctrine as my ORM. My question is this: What is the best way to pass in highly-complex sql queries directly to…
Levi Hackwith
  • 9,232
  • 18
  • 64
  • 115
44
votes
7 answers

Complex WHERE clauses using the PHP Doctrine ORM

I'm using the PHP Doctrine ORM to build my queries. However, I can't quite seem to figure how to write the following WHERE clause using DQL (Doctrine Query Language): WHERE name='ABC' AND (category1 = 'X' OR category2 = 'X' OR category3 = 'X') AND…
Wickethewok
  • 6,534
  • 11
  • 42
  • 40
43
votes
8 answers

tar: Error is not recoverable: exiting now

when I untar doctrine -rw-r--r-- 1 root root 660252 2010-10-16 23:06 Doctrine-1.2.0.tgz I always get this error messages root@X100e:/usr/local/lib/Doctrine/stable# tar -xvzf…
udo
  • 4,832
  • 4
  • 54
  • 82
43
votes
8 answers

Why doesn't MySQL support millisecond / microsecond precision?

So I just found the most frustrating bug ever in MySQL. Apparently the TIMESTAMP field, and supporting functions do not support any greater precision than seconds!? So I am using PHP and Doctrine, and I really need those microseconds (I am using…
Byron Whitlock
  • 52,691
  • 28
  • 123
  • 168
42
votes
2 answers

symfony2 doctrine allow null values?

So, I'm still REALLY new to symfony but i'm learning quickly... I created an entity and a crud (i forget how I did it actually but it was via the command line).. The entity was created with this in it: namespace Ecs\CrmBundle\Entity; use…
Johnny
  • 841
  • 3
  • 10
  • 25
42
votes
4 answers

How do I use a complex criteria inside a doctrine 2 entity's repository?

Lets say I have a table that holds information about festivals. Each festival has a start and end date. I want to select all the festivals that are live (that happen) on a given date. Meaning, I want to select all the festivals that their start date…
Doron
  • 3,176
  • 7
  • 35
  • 60
41
votes
2 answers

Zend Framework 2 + Doctrine 2

I would like to start developing with Zend Framework and I would like to use zf2. Since I use Doctrine 2, can you suggest some tutorials to help me to integrate it in zf2? Thanks!
flux
  • 526
  • 1
  • 7
  • 10
41
votes
2 answers

Symfony2 - Using Form Builder Without Any Entity Attached

I have been using the form builder with Symfony2, and find it quite nice. I find myself wanting to create a search page with a series of boxes at the top to filter search results. I have three different entities as of now (judges, interpreters,…
Josh Wa
  • 1,049
  • 2
  • 9
  • 12
40
votes
2 answers

How to enable ENUMs in Symfony 2 / Doctrine

When running doctrine:mapping:import i get an error: Unknown database type enum requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it. It seems I need to set use_native_enum to true some how. However, all documentation and blog posts…
Roel Veldhuizen
  • 4,613
  • 8
  • 44
  • 78
40
votes
3 answers

How to get a Collection in Doctrine2's query results

I am trying to execute a query using doctrine2 and need it to return a collection object. Simplified snippet: $players = $this->getEntityManager() ->createQueryBuilder() ->select('p') ->from('...\Player', 'p') ->getQuery() …
mkraemer
  • 658
  • 1
  • 7
  • 9