Questions tagged [doctrine]
15 questions
30
votes
6 answers
Should I choose Doctrine 2 or Propel 1.5/1.6, and why?
I'd like to hear from those who have used Doctrine 2 (or later) and Propel 1.5 (or later). Most comparisons between these two object relational mappers are based on old versions -- Doctrine 1 versus Propel 1.3/1.4, and both ORMs went through…

Billy ONeal
- 8,073
- 6
- 43
- 57
6
votes
4 answers
How to design an unpredictable model?
I have been working on a project that deals with, let me simplify, Schools and Students.
The general requirement is that certain Students could be assigned to certain Schools to work an internship.
But the Schools are not only Schools per se, those…

Đuro Mandinić
- 216
- 1
- 7
4
votes
2 answers
Is doctrine 2 fast enough?
I need to build a social network that is expecting very high traffic, 10k - 50k + registrations in a day, not even including visitors, pageviews, image uploads, etc..., a lot of database activity. We have a solid quad core dedicated server right now…

Andrew Fashion
- 151
- 4
3
votes
1 answer
Building a DBAL from scratch
I am considering building a DBAL from scratch with PHP to use within my projects and also to learn through the process.
I have noticed on SO and other reputable forums that whenever this is mentioned most users advise to use an established DBAL like…

cecilli0n
- 261
- 1
- 2
- 7
2
votes
1 answer
Entities and polymorphic relationships
Lets say that I have a shelf on which I can put items that are shelfable (not sure if that is actually a word but you can understand my point).
So I have the following:
class Shelf
{
/** @var ShelfableItemInterface[] **/
private $items =…

mysubject
- 29
- 3
1
vote
1 answer
What are the benefits of using lazy initialization when i.e. calling Doctrine's EntityManager?
TL;DR: I have noted that some tutorials are using an extra method call to retrieve a variable, in my case EntityManager of Doctrine. Is it generally a good idea to use such extra method call, when it seemingly adds overhead, even if this overhead…

Dennis
- 8,157
- 5
- 36
- 68
1
vote
1 answer
Why does ORM persist() functionality use references to populate insert_id and not return?
My understanding of how ORM persist works:
//ORM "persist" oversimplification
function persist(&$entity)
{
...
$insertId = api_actual_db_insert(...);
$entity->setId($insertId);
}
//usage of ORM later…

Dennis
- 8,157
- 5
- 36
- 68
1
vote
1 answer
How to associate both a collection and one item of this collection to an entity
I'm working on a project in which I have an entity, we may call Users and another entity Address.
I want to define the entity User in a way that an user would have a collection of addresses (typically a One-To-Many relationship), but I also need an…

ibi0tux
- 241
- 2
- 11
1
vote
2 answers
Repository Pattern: Doctrine2 vs Microsoft Entity Framework?
I have been using Symfony2 with Doctrine2 for some years. I have recently started using Microsoft's Entity Framework with MVC5. From my Symfony2 experience I understand that a repository's job is only to retrieve and return objects, no additional…

d0001
- 111
- 5
1
vote
1 answer
When using an ORM should mappings be defined in the code file?
Doctrine offers three ways to define the object mapping properties: in XML, in YAML and as inline docblock annotations in the code. The Doctrine documentation doesn't give any advice on choosing among them, but I'm specifically wondering if there…

jwrush
- 249
- 1
- 10
0
votes
2 answers
Should i use an abstract class or an interface for my doctrine model?
In Doctrine, assuming I want to implement different types of vehicles. Maybe a car, a plane, a bicycle and so on ... all these vehicles have many different properties but also very common things like they are all made of a material.
So if i want to…

Jim Panse
- 338
- 3
- 11
0
votes
1 answer
Multiple intranet/internet systems partially working on same data - database strategy
We are starting rewritting our apps (Internet portal, millions of unique users and few CRM/ERP systems, few hundred users) and we have a huge decision to make now. We are going to write them mostly (90-95%) in Symfony2 with Doctrine, and some…

ex3v
- 556
- 7
- 18
0
votes
1 answer
Doctrine 2 and Concrete table inheritance
I use Doctrine 2 and I've read some articles on inheritance strategies' mapping with ORM.
I've seen three main strategies : "Class table inheritance", "Concrete table inheritance" and "Single table inheritance".
With Doctrine 2, I managed an install…

csblo
- 239
- 3
- 9
0
votes
2 answers
Is my application vulnerable to SQL injection if I don't specify each type in Doctrine2?
I thought Doctrine 2 DBAL prepared statements were safe from SQLi. But I found this confusing bit in the docs:
By default the Doctrine DBAL does no escaping. Escaping is a very
tricky business to do automatically, therefore there is none by
…

ChocoDeveloper
- 393
- 1
- 4
- 14
-1
votes
1 answer
Multiple application sharing same database functionalities
We have two application A and B that I'm refactoring. They both use the same database. Those application are written using the Symfony framework and Doctrine as database layer.
I've moved some of the business logic from A into a library in the same…

Nicolas Appriou
- 115
- 3