public function setEmail($email, $force = false) { $email = trim($email); if (($this->isNew() || $force === true) && ($email === null || $email == "")) { throw new InvalidArgumentException("customer email is mandatory"); } if (!$this->isNew() && $force === false) { return $this; } return parent::setEmail($email); }