/** * {@inheritdoc} */ public function delete($address, $andFlush = true) { if ($address->getCurrent()) { $custAddresses = $address->getCustomer()->getAddressesByType(AddressInterface::TYPE_DELIVERY); if (count($custAddresses) > 1) { foreach ($custAddresses as $currentAddress) { if ($currentAddress->getId() !== $address->getId()) { $currentAddress->setCurrent(true); $this->save($currentAddress); break; } } } } parent::delete($address, $andFlush); }
/** * {@inheritDoc} */ public function delete($comment, $andFlush = true) { $post = $comment->getPost(); parent::delete($comment, $andFlush); $this->updateCommentsCount($post); }