1: <?php
2: /**
3: * This code is licensed under Afterlogic Software License.
4: * For full statements of the license see LICENSE file.
5: */
6:
7: namespace Aurora\Modules\MailMultiAccountsPlugin;
8:
9: /**
10: * @license https://afterlogic.com/products/common-licensing Afterlogic Software License
11: * @copyright Copyright (c) 2023, Afterlogic Corp.
12: */
13: class Manager extends \Aurora\Modules\Mail\Managers\Accounts\Manager
14: {
15: /**
16: * @param \Aurora\Modules\Mail\Models\MailAccount $oAccount
17: *
18: * @return bool
19: */
20: public function createAccount(\Aurora\Modules\Mail\Models\MailAccount &$oAccount)
21: {
22: $bResult = false;
23:
24: if ($oAccount->validate()) {
25: if (!$this->isExists($oAccount)) {
26: if (!$oAccount->save()) {
27: throw new \Aurora\System\Exceptions\ManagerException(\Aurora\System\Exceptions\Errs::UserManager_AccountCreateFailed);
28: }
29: } else {
30: throw new \Aurora\System\Exceptions\ApiException(\Aurora\System\Notifications::AccountExists);
31: }
32: }
33:
34: $bResult = true;
35:
36: return $bResult;
37: }
38: }
39: