create error message when a customer is deleted and already have orders.

Fix #199
This commit is contained in:
Manuel Raynaud
2014-02-19 10:41:26 +01:00
parent 5caa55c345
commit 16275ef51a
5 changed files with 74 additions and 3 deletions

View File

@@ -239,6 +239,15 @@ class Customer extends BaseCustomer implements UserInterface
return $this->getRememberMeSerial();
}
public function hasOrder()
{
$order = OrderQuery::create()
->filterByCustomerId($this->getId())
->count();
return $order > 0;
}
/**
* {@inheritDoc}
*/