What are the consequences, problems if Enity does not match the database schema. For example, I have an entity class SKU and its description. It defines the property $amountOfPackaging .

 /** * Количество в упаковке * @var string * * @ORM\Column(type="decimal", precision = 10, scale = 3) * @Assert\NotBlank() */ 

1. What could be the consequences / problems if I change the digit capacity of this field at the database level for example 10.4?
2. What can the declared connections at the database level lead to and are not described in the Enity classes.

  • Why not just test you? - AmsTaFFix 6:54 pm
  • I tried. At the database level, removed all connections, left only at the Doctrine level, also changed the width of several columns in the table. So far, there have been no consequences. - Vadim Bondarenko
  • Well, that's all)) if you want to know more precisely, then refer to the source code of the doctrine, in which I, alas, is not strong - AmsTaFFix
  • Most likely, such accuracy in describing the column is needed to create tables from entities - AmsTaFFix
  • I asked a question with digit capacity for completeness, I was more interested in communication. An interesting point is obtained at the level of the communication database, but there is no logical reason why the performance of the database server probably should increase, but I'm not sure. - Vadim Bondarenko

1 answer 1

  1. What can the declared connections at the database level lead to and are not described in the Enity classes.

I believe that potentially there may be problems when trying to delete such entities. The doctrine does not know about the connection, the DB knows. The doctrine will miss the operation - there is no DB.

Also, if not accidentally (I understand, it is unlikely), run the php app/console doctrine:schema:update --force --complete command php app/console doctrine:schema:update --force --complete - then it will remove all changes from the database that do not conform to the doctrine data scheme.

In addition, I see this as a problem in the complication of the application itself, because now you have to keep in mind not only the classes of entities, but also remember about the connections in the database itself, which are registered separately. And it will be harder to implement business logic if knowledge about relationships is not clearly defined in entity classes.

In addition, I would also think about the Deploy. After all, communication can change. How to deal with this?