This gist is about:
- https://twitter.com/taylorotwell/status/600680897550098432
- https://twitter.com/Ocramius/status/600705252539691008
Mainly:
functioncannot (should not) be used when side-effects occur
This gist is about:
Mainly:
function cannot (should not) be used when side-effects occurTLDR: The cascade={"remove"} is like a "software" onDelete="CASCADE", and will remove objects from the database only when an explicit call to $em->remove() occurs. Thus, it could result in more than one object being deleted. orphanRemoval can remove objects from the database even if there was no explicit call to ->remove().
I answered this question a few times to different people so I will try to sum things up in this Gist.
Let's take two entities A and B as an example. I will use a OneToOne relationship in this example but it works exactly the same with OneToMany relationships.
class A| /** | |
| * Activation Class | |
| **/ | |
| if ( ! class_exists( 'WC_CPInstallCheck' ) ) { | |
| class WC_CPInstallCheck { | |
| static function install() { | |
| /** | |
| * Check if WooCommerce & Cubepoints are active | |
| **/ | |
| if ( !in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) || |