I switched to using symfony2.0 to develop the project and would like to ask some questions.
某草草
某草草 2017-05-16 16:46:03
0
1
502

I used to use symfony1.4+propel to develop projects, and now I switch to symfony2.0, but I have never used doctrine, but the official default is doctrine and removes propel.
1. What are the advantages of using doctrine? Relative to prop. Projects are systems aspects.
2. When using prop, I found that group by is not very useful, right?
3.How does doctrine handle the many-to-many M:N relationship?

In addition, I post possible problems with doctrine, and I refer to others:
1. Documentation error. Use options to configure additional field options, such as unsigned and default attributes. Official documents and generated yml are specified directly on the field.
2. Foreign keys cannot specify unsigned or default
3. The table relationship is non-identifying relationship

grateful!

某草草
某草草

reply all(1)
刘奇

The functions supported by "standard" Doctrine are a collection of functions that are supported by all relational databases (MySQL, PostgrelSql, etc.) supported by PDO. In other words, anything that A supports but B does not support will not be supported by Doctrine by default. Yes, but Doctrine has good scalability and rich third-party code. I don’t know how to search it on Baidu. If I search Doctrine+Extensions on Google, I will gain a lot.

Doctrine’s many-to-many support is pretty good and sufficient.

You can still use Propel in Symfony 2, there is a dedicated chapter in the official website documentation.

Doctrine and Propel are both good (you can write the database package yourself, or you can be a good comrade). It’s better to choose each one. If you have to compare, you can cite some objective differences:

  1. Doctrine is the Data Mapper + Proxy mode, and Propel is the Active Record mode (this is a philosophical question);
  2. Doctrine’s community is more active;
  3. Symfony 2 uses Doctrine’s Common library to implement annotation-based dependency injection (DI);
  4. Doctrine is more modern (2.x) and has better feature support for PHP 5.3+, but Propel is also catching up.

As mentioned before, the unsigned feature you mentioned cannot be used across databases, so naturally it is not supported by default. However, if necessary, there are many ways to do it, so I won’t go into this answer.

Default is not an attribute that can cross databases, but you can just define a default value for the mapped member variables in Doctrine's Entity class. What more can I ask for?

Doctrine’s promise is that it can be used across libraries. I think good code only does what it promises. From this point of view, Doctrine can still make people feel at ease. After all, there are still many people using PostgreSql or SQLite, so don’t use MySQL thinking to force consistency.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template