/** * @param Email $email * @param EmailThread $thread */ protected function processThread(Email $email, EmailThread $thread) { if ($email->getId()) { if (!$email->getThread() || $email->getThread()->getId() != $thread->getId()) { throw $this->createInvalidPropertyException('Thread', $email->getThread() ? $email->getThread()->getId() : null, $thread->getId()); } } else { $email->setThread($thread); } }