/** * @param string $email * @param bool $safety * @param int $idUser * @return bool */ function SetSenders($email, $safety, $idUser) { if (!$this->_dbConnection->Execute($this->_commandCreator->SelectSendersByEmail($email, $idUser))) { return false; } if ($this->_dbConnection->ResultCount() > 0) { $row =& $this->_dbConnection->GetNextRecord(); if (is_object($row) && isset($row->safety) && $row->safety != $safety) { if (!$this->_dbConnection->Execute($this->_commandCreator->UpdateSenders($email, $safety, $idUser))) { return false; } } } else { if (!$this->_dbConnection->Execute($this->_commandCreator->InsertSenders($email, $safety, $idUser))) { return false; } } return true; }