public function delete()
{
if (!$this->isTransactional(self::OP_DELETE)) {
return $this->deleteInternal();
}
$transaction = static::getDb()->beginTransaction();
try {
$result = $this->deleteInternal();
if ($result === false) {
$transaction->rollBack();
} else {
$transaction->commit();
}
return $result;
} catch (\Exception $e) {
$transaction->rollBack();
throw $e;
}
}
public function delete() { foreach ($this->answerVariants as $model) { $model->delete(); } parent::delete(); }