Doctrine: cascade=“remove” vs orphanremoval=true
问题 What is the difference between the 2 options above? When is it preferable to choose each option? 回答1: The basic difference between them is: When using the orphanRemoval=true option Doctrine makes the assumption that the entities are privately owned and will NOT be reused by other entities. If you neglect this assumption your entities will get deleted by Doctrine even if you assigned the orphaned entity to another one. Say your User has one-to-many relation to Comment . If you are using