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

Doctrine annotation "@Doctrine\ORM\Annotation\Entity" in class does not exist or cannot be autoloaded

I'm following the Doctrine Getting Started tutorial to the letter. I've created the Product class (by copy/pasting from the tutorial, to ensure no typos), but when I run vendor/bin/doctrine orm:schema-tool:create I get [OK] No Metadata Classes to…
Adam Hopkinson
  • 28,281
  • 7
  • 65
  • 99
3
votes
2 answers

Underscore in gets and sets in symfony entity

In my entity, i've got a field with underscore in variable name, like this: /** * @ORM\Column(type="text", nullable=true) */ private $value_text; And, for example, a get function: public function getValueText() { return…
Rallyholic
  • 317
  • 1
  • 3
  • 21
3
votes
1 answer

Dynamic Doctrine relationship inverse side methods

I'm having a couple of entity with tags. I've created a dynamic relationship based in this blog post: class TaggableListener implements EventSubscriber { /** * @return array */ public function getSubscribedEvents() { …
Stephan Vierkant
  • 9,674
  • 8
  • 61
  • 97
3
votes
2 answers

Symfony - Return type for Doctrine entity

Since php7 we already know that it is possible to declare the function's return type. Then if that function returns something else, an exception is thrown. Now I would like to use this new feature when a function in my Symfony project returns a…
DrKey
  • 3,365
  • 2
  • 29
  • 46
3
votes
3 answers

How to get the following array from database?

Ok to make it more clear: I am Using doctrine I have a table Brands and Products Brand id name Product id name brand_id I have a lot of brands and Products of those brands in the database. I would like to retrieve List of brands(+ count…
simple
  • 1,091
  • 4
  • 14
  • 32
3
votes
0 answers

Doctrine: ODM vs. ORM

I consider using ODM/ORM/mixing ODM and ORM entities in my new Doctrine 2.0 project. When should I use ORM (MySQL InnoDB) and when ODM (MongoDB)? Should I mix it in one project? Pseudo structure of my app (Google Reader like): user { id, login,…
elniño
  • 121
  • 1
  • 7
3
votes
1 answer

Doctrine2: Warning: Illegal offset type in isset or empty

I've a ManyToMany relation in Listing entity: /** * @ORM\Entity(repositoryClass="AppBundle\Repository\ListingRepository") * @ORM\Table(name="listings") */ class Listing extends MainEntity { /** * @ORM\Id * @ORM\Column(type="uuid") …
rvaliev
  • 1,051
  • 2
  • 12
  • 31
3
votes
2 answers

How to correctly use doctrine migrations with postressql

I've got a symfony 2.8 project with a postgressql database and the ID generation strategy is IDENTITY but every command I enter like doctrine:schema:update or doctrine:migrations:migrate return an error like this: An exception occurred while…
Jul6art
  • 219
  • 3
  • 14
3
votes
2 answers

Symfony - DoctrineBundle is not registered in your application

I have a problem with Doctrine Bundle. When i try entry to webpage i have error: The DoctrineBundle is not registered in your application. It's strange because in config/bundles.php i has: return [ …
3
votes
3 answers

Symfony sfDoctrineGuardPlugin custom login query

I use symfony sfDoctrineGuardPlugin to manage authentication for both frontend users and backend users. It's fine, except that I don't want frontend users to be able to login to the backend app. I can setup credentials, but credentials are checked…
Dziamid
  • 11,225
  • 12
  • 69
  • 104
3
votes
2 answers

Why Doctrine don't return my values in array?

I have an entity NewsVersion with ManyToMany : class NewsVersion { ... /** * @var NewsCategory[]|ArrayCollection * * @ORM\ManyToMany( * targetEntity="AppBundle\Entity\NewsCategory", * cascade={"persist"} …
Gaylord.P
  • 1,539
  • 2
  • 24
  • 54
3
votes
0 answers

doctrine migration generate update when no change has been done

I use doctrine migration to update my database. I've created an entity which hold and image sotre in a mediumtext : /** * Avatar of the person * @var string * * @ORM\Column(name="avatar", type="string", length=500000, nullable=true) *…
user6241056
3
votes
1 answer

Doctrine MongoDB ODM - Return only matched embedded document using query builder

I am having trouble in returning only the matched embedded document using MongoDB ODM query builder in PHP. Each embedded document has a MongoID generated at the time of creation. Following is my document structure of collection Project: { …
Seeker
  • 1,877
  • 4
  • 32
  • 56
3
votes
1 answer

Doctrine distances function

I try to use a function which calculate distance between $user lat/lng and coordinates in my BDD with limited distance. It's an SQL request and I try to use Doctrine to implement it. Here is my code $config = new…
3
votes
1 answer

Unknown database type json requested, Doctrine\DBAL\Platforms\PostgreSqlPlatform may not support it

Developing using Symfony 2.7 I have entity which contain attribute /** * @var array * @ORM\Column(name="new_entry_name", type="json_array", nullable=true) */ protected $newEntryName; but when i update my schema using php app/console…