This association between Addresses and Customers currently orphans and Address if the Customer is deleted:
I'm probably going to change this in our project - unless anyone can thing of a good reason for it? I don't see the value in a customer address without it's customer?
The customer addresses should be removed together with customer. However the customer address is cloned to Order and the relation to customer probably stays. It is probably also the cause of duplicating the addresses after checkout and the reason we set null on delete. Of course it is a bug and should be resolved.
Hey @michalmarcinkowski,
I just checked in our app and customer relation is not cloned for order addresses, although not sure if this is something we changed.
On master it is in AddressingStepType :)
Cascade deleting will reveal the bug which will result in deleting address of all orders of this customer, so here after cloning we should setCustomer(null).
hmm it does though on the very next line?
You're right! Don't know how I missed that 馃槥 Then I don't see any reason we shouldn't cascade delete addresses.
Another one that should cascade:
Apologies I'm crazy busy to do a PR, just pointing these out then it's up to you...
@peteward No worries, we will take care of that, thanks for the pointers! :)
Already fixed.
Most helpful comment
Another one that should cascade:
https://github.com/Sylius/Sylius/blob/f5d1b5f7fe845adfcc2fac485d6e19cd1708e03b/src/Sylius/Bundle/OrderBundle/Resources/config/doctrine/model/Comment.orm.xml#L39
Apologies I'm crazy busy to do a PR, just pointing these out then it's up to you...