mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
throws tags
This commit is contained in:
@@ -29,6 +29,8 @@
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
use Espo\Core\Exceptions\Error;
|
||||
use Espo\Core\Exceptions\Forbidden;
|
||||
use Espo\Core\Mail\Account\PersonalAccount\Service;
|
||||
use Espo\Core\Mail\Account\Storage\Params as StorageParams;
|
||||
|
||||
@@ -44,6 +46,8 @@ class EmailAccount extends Record
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
* @throws Forbidden
|
||||
* @throws Error
|
||||
*/
|
||||
public function postActionGetFolders(Request $request): array
|
||||
{
|
||||
@@ -63,6 +67,10 @@ class EmailAccount extends Record
|
||||
return $this->getEmailAccountService()->getFolderList($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Error
|
||||
* @throws Forbidden
|
||||
*/
|
||||
public function postActionTestConnection(Request $request): bool
|
||||
{
|
||||
$data = $request->getParsedBody();
|
||||
|
||||
@@ -45,6 +45,8 @@ class EmailAddress extends RecordBase
|
||||
|
||||
/**
|
||||
* @return array<int,array<string,mixed>>
|
||||
* @throws Forbidden
|
||||
* @throws BadRequest
|
||||
*/
|
||||
public function actionSearchInAddressBook(Request $request): array
|
||||
{
|
||||
|
||||
@@ -35,12 +35,12 @@ use Espo\{
|
||||
};
|
||||
|
||||
use Espo\Core\{
|
||||
Exceptions\Conflict,
|
||||
Exceptions\Error,
|
||||
Exceptions\Forbidden,
|
||||
Exceptions\BadRequest,
|
||||
Api\Request,
|
||||
DataManager,
|
||||
};
|
||||
DataManager};
|
||||
|
||||
class FieldManager
|
||||
{
|
||||
@@ -50,6 +50,9 @@ class FieldManager
|
||||
|
||||
private $fieldManagerTool;
|
||||
|
||||
/**
|
||||
* @throws Forbidden
|
||||
*/
|
||||
public function __construct(User $user, DataManager $dataManager, FieldManagerTool $fieldManagerTool)
|
||||
{
|
||||
$this->user = $user;
|
||||
@@ -59,6 +62,9 @@ class FieldManager
|
||||
$this->checkControllerAccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Forbidden
|
||||
*/
|
||||
protected function checkControllerAccess(): void
|
||||
{
|
||||
if (!$this->user->isAdmin()) {
|
||||
@@ -68,6 +74,8 @@ class FieldManager
|
||||
|
||||
/**
|
||||
* @return array<string,mixed>
|
||||
* @throws BadRequest
|
||||
* @throws Error
|
||||
*/
|
||||
public function getActionRead(Request $request): array
|
||||
{
|
||||
@@ -83,6 +91,9 @@ class FieldManager
|
||||
|
||||
/**
|
||||
* @return array<string,mixed>
|
||||
* @throws BadRequest
|
||||
* @throws Conflict
|
||||
* @throws Error
|
||||
*/
|
||||
public function postActionCreate(Request $request): array
|
||||
{
|
||||
@@ -113,6 +124,8 @@ class FieldManager
|
||||
|
||||
/**
|
||||
* @return array<string,mixed>
|
||||
* @throws BadRequest
|
||||
* @throws Error
|
||||
*/
|
||||
public function patchActionUpdate(Request $request): array
|
||||
{
|
||||
@@ -121,6 +134,8 @@ class FieldManager
|
||||
|
||||
/**
|
||||
* @return array<string,mixed>
|
||||
* @throws BadRequest
|
||||
* @throws Error
|
||||
*/
|
||||
public function putActionUpdate(Request $request): array
|
||||
{
|
||||
@@ -146,6 +161,10 @@ class FieldManager
|
||||
return $fieldManagerTool->read($scope, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws BadRequest
|
||||
* @throws Error
|
||||
*/
|
||||
public function deleteActionDelete(Request $request): bool
|
||||
{
|
||||
$scope = $request->getRouteParam('scope');
|
||||
@@ -162,6 +181,10 @@ class FieldManager
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws BadRequest
|
||||
* @throws Error
|
||||
*/
|
||||
public function postActionResetToDefault(Request $request): bool
|
||||
{
|
||||
$data = $request->getParsedBody();
|
||||
@@ -173,7 +196,6 @@ class FieldManager
|
||||
$this->fieldManagerTool->resetToDefault($data->scope, $data->name);
|
||||
|
||||
$this->dataManager->clearCache();
|
||||
|
||||
$this->dataManager->rebuildMetadata();
|
||||
|
||||
return true;
|
||||
|
||||
@@ -44,6 +44,7 @@ class InboundEmail extends Record
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
* @throws \Espo\Core\Exceptions\Error
|
||||
*/
|
||||
public function postActionGetFolders(Request $request): array
|
||||
{
|
||||
|
||||
@@ -29,10 +29,12 @@
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
use Espo\Core\Exceptions\Error;
|
||||
use Espo\Core\Exceptions\Forbidden;
|
||||
use Espo\Core\Exceptions\BadRequest;
|
||||
|
||||
use Espo\Core\Api\Request;
|
||||
use Espo\Core\Exceptions\NotFound;
|
||||
use Espo\Services\Layout as Service;
|
||||
use Espo\Entities\User;
|
||||
|
||||
@@ -50,6 +52,10 @@ class Layout
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @throws Forbidden
|
||||
* @throws NotFound
|
||||
* @throws Error
|
||||
* @throws BadRequest
|
||||
*/
|
||||
public function getActionRead(Request $request)
|
||||
{
|
||||
@@ -67,6 +73,10 @@ class Layout
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @throws Forbidden
|
||||
* @throws BadRequest
|
||||
* @throws NotFound
|
||||
* @throws Error
|
||||
*/
|
||||
public function putActionUpdate(Request $request)
|
||||
{
|
||||
@@ -95,6 +105,10 @@ class Layout
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @throws Forbidden
|
||||
* @throws BadRequest
|
||||
* @throws NotFound
|
||||
* @throws Error
|
||||
*/
|
||||
public function postActionResetToDefault(Request $request)
|
||||
{
|
||||
@@ -113,6 +127,10 @@ class Layout
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @throws BadRequest
|
||||
* @throws Forbidden
|
||||
* @throws NotFound
|
||||
* @throws Error
|
||||
*/
|
||||
public function getActionGetOriginal(Request $request)
|
||||
{
|
||||
|
||||
@@ -99,6 +99,7 @@ class LeadCapture extends Record
|
||||
|
||||
/**
|
||||
* @return stdClass[]
|
||||
* @throws Forbidden
|
||||
*/
|
||||
public function getActionSmtpAccountDataList(): array
|
||||
{
|
||||
|
||||
@@ -119,6 +119,7 @@ class MassAction
|
||||
|
||||
/**
|
||||
* @return array<string,mixed>
|
||||
* @throws BadRequest
|
||||
*/
|
||||
private function prepareMassActionParams(stdClass $data): array
|
||||
{
|
||||
@@ -149,6 +150,9 @@ class MassAction
|
||||
throw new BadRequest("Bad search params for mass action.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Error
|
||||
*/
|
||||
private function convertResult(ServiceResult $serviceResult): stdClass
|
||||
{
|
||||
if (!$serviceResult->hasResult()) {
|
||||
|
||||
@@ -49,6 +49,7 @@ class Metadata extends Base
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @throws Forbidden
|
||||
*/
|
||||
public function getActionGet(Request $request)
|
||||
{
|
||||
|
||||
@@ -87,6 +87,9 @@ class Helper
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Doctrine\DBAL\Exception
|
||||
*/
|
||||
public function getDbalConnection(): DbalConnection
|
||||
{
|
||||
if (!isset($this->dbalConnection)) {
|
||||
@@ -118,6 +121,7 @@ class Helper
|
||||
/**
|
||||
* @param array<string,mixed> $params
|
||||
* @throws RuntimeException
|
||||
* @throws \Doctrine\DBAL\Exception
|
||||
*/
|
||||
public function createDbalConnection(array $params = []): DbalConnection
|
||||
{
|
||||
|
||||
@@ -183,6 +183,7 @@ class Schema
|
||||
* Rebuild database schema.
|
||||
*
|
||||
* @param ?string[] $entityList
|
||||
* @throws \Doctrine\DBAL\Schema\SchemaException
|
||||
*/
|
||||
public function rebuild(?array $entityList = null): bool
|
||||
{
|
||||
@@ -259,6 +260,7 @@ class Schema
|
||||
* Get SQL queries to get from one to another schema.
|
||||
*
|
||||
* @return string[] Array of SQL queries.
|
||||
* @throws \Doctrine\DBAL\Schema\SchemaException
|
||||
*/
|
||||
public function getDiffSql(DBALSchema $fromSchema, DBALSchema $toSchema)
|
||||
{
|
||||
|
||||
@@ -51,6 +51,7 @@ class SchemaProxy
|
||||
|
||||
/**
|
||||
* @param ?string[] $entityList
|
||||
* @throws \Doctrine\DBAL\Schema\SchemaException
|
||||
*/
|
||||
public function rebuild(?array $entityList = null): bool
|
||||
{
|
||||
|
||||
@@ -39,6 +39,7 @@ class FulltextIndex extends BaseRebuildActions
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \Doctrine\DBAL\Exception
|
||||
*/
|
||||
public function beforeRebuild()
|
||||
{
|
||||
|
||||
@@ -39,6 +39,8 @@ use Espo\Core\{
|
||||
ORM\EntityManager,
|
||||
};
|
||||
|
||||
use Exception;
|
||||
use RuntimeException;
|
||||
use DateTime;
|
||||
|
||||
class ScheduledJob
|
||||
@@ -151,8 +153,13 @@ class ScheduledJob
|
||||
*/
|
||||
public function isCronConfigured(): bool
|
||||
{
|
||||
$r1From = new DateTime('-' . $this->checkingCronPeriod);
|
||||
$r1To = new DateTime('+' . $this->checkingCronPeriod);
|
||||
try {
|
||||
$r1From = new DateTime('-' . $this->checkingCronPeriod);
|
||||
$r1To = new DateTime('+' . $this->checkingCronPeriod);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
$r2From = new DateTime('-1 hour');
|
||||
$r2To = new DateTime();
|
||||
|
||||
@@ -35,6 +35,7 @@ use Ratchet\Wamp\WampServerInterface;
|
||||
use Symfony\Component\Process\PhpExecutableFinder;
|
||||
|
||||
use Exception;
|
||||
use RuntimeException;
|
||||
|
||||
class Pusher implements WampServerInterface
|
||||
{
|
||||
@@ -97,7 +98,7 @@ class Pusher implements WampServerInterface
|
||||
$this->log("Error: No php-executable-path.");
|
||||
}
|
||||
|
||||
throw new Exception("No php-executable-path.");
|
||||
throw new RuntimeException("No php-executable-path.");
|
||||
}
|
||||
|
||||
$this->phpExecutablePath = $phpExecutablePath;
|
||||
|
||||
@@ -240,6 +240,7 @@ class Image implements EntryPoint
|
||||
/**
|
||||
* @return \GdImage
|
||||
* @phpstan-ignore-next-line
|
||||
* @throws Error
|
||||
*/
|
||||
protected function createThumbImage(string $filePath, string $fileType, string $size)
|
||||
{
|
||||
|
||||
@@ -53,6 +53,7 @@ class StreamNotesAcl
|
||||
|
||||
/**
|
||||
* @param array<string,mixed> $options
|
||||
* @throws \Espo\Core\Exceptions\Error
|
||||
*/
|
||||
public function afterSave(Entity $entity, array $options): void
|
||||
{
|
||||
|
||||
@@ -171,6 +171,7 @@ class Activities
|
||||
/**
|
||||
* @throws Forbidden
|
||||
* @throws NotFound
|
||||
* @throws BadRequest
|
||||
*/
|
||||
public function getActionListUpcoming(Request $request): stdClass
|
||||
{
|
||||
|
||||
@@ -39,6 +39,9 @@ class Document extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
/**
|
||||
* @return \stdClass[]
|
||||
* @throws BadRequest
|
||||
* @throws Forbidden
|
||||
* @throws \Espo\Core\Exceptions\NotFound
|
||||
*/
|
||||
public function postActionGetAttachmentList(Request $request): array
|
||||
{
|
||||
|
||||
@@ -57,6 +57,7 @@ class MassEmail extends \Espo\Core\Controllers\Record
|
||||
|
||||
/**
|
||||
* @return stdClass[]
|
||||
* @throws Forbidden
|
||||
*/
|
||||
public function getActionSmtpAccountDataList(): array
|
||||
{
|
||||
|
||||
@@ -121,6 +121,8 @@ class Opportunity extends \Espo\Core\Controllers\Record
|
||||
|
||||
/**
|
||||
* @return stdClass[]
|
||||
* @throws Forbidden
|
||||
* @throws BadRequest
|
||||
*/
|
||||
public function getActionEmailAddressList(Request $request): array
|
||||
{
|
||||
|
||||
@@ -1628,6 +1628,7 @@ class Activities implements
|
||||
* @param ?string[] $scopeList
|
||||
* @return array<int,array<string,mixed>>
|
||||
* @throws Forbidden
|
||||
* @throws NotFound
|
||||
*/
|
||||
public function getEventsForTeams(array $teamIdList, string $from, string $to, ?array $scopeList = null): array
|
||||
{
|
||||
@@ -1639,6 +1640,7 @@ class Activities implements
|
||||
* @param ?string[] $scopeList
|
||||
* @return array<int,array<string,mixed>>
|
||||
* @throws Forbidden
|
||||
* @throws NotFound
|
||||
*/
|
||||
public function getTeamsEventList(array $teamIdList, string $from, string $to, ?array $scopeList = null): array
|
||||
{
|
||||
|
||||
@@ -43,6 +43,8 @@ class Document extends Record
|
||||
{
|
||||
/**
|
||||
* @return \Espo\ORM\Collection<Attachment>
|
||||
* @throws NotFound
|
||||
* @throws \Espo\Core\Exceptions\Forbidden
|
||||
*/
|
||||
public function getAttachmentList(string $id)
|
||||
{
|
||||
|
||||
@@ -233,6 +233,8 @@ class Lead extends Record implements
|
||||
|
||||
/**
|
||||
* @param stdClass|null $additionalData
|
||||
* @throws Forbidden
|
||||
* @throws ConflictSilent
|
||||
*/
|
||||
public function convert(string $id, object $recordsData, ?object $additionalData = null): LeadEntity
|
||||
{
|
||||
|
||||
@@ -132,6 +132,7 @@ class MassEmail extends Record
|
||||
|
||||
/**
|
||||
* @param iterable<Entity> $targetList
|
||||
* @throws Error
|
||||
*/
|
||||
protected function createTestQueue(MassEmailEntity $massEmail, iterable $targetList): void
|
||||
{
|
||||
@@ -140,6 +141,9 @@ class MassEmail extends Record
|
||||
$queue->create($massEmail, true, $targetList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Error
|
||||
*/
|
||||
protected function processTestSending(MassEmailEntity $massEmail): void
|
||||
{
|
||||
$processor = $this->injectableFactory->create(Processor::class);
|
||||
|
||||
@@ -57,6 +57,10 @@ class Opportunity extends Record
|
||||
'accountName',
|
||||
];
|
||||
|
||||
/**
|
||||
* @throws Forbidden
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function reportSalesPipeline(
|
||||
string $dateFilter,
|
||||
?string $dateFrom = null,
|
||||
@@ -160,6 +164,10 @@ class Opportunity extends Record
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Forbidden
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function reportByLeadSource(
|
||||
string $dateFilter,
|
||||
?string $dateFrom = null,
|
||||
@@ -227,6 +235,10 @@ class Opportunity extends Record
|
||||
return (object) $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Forbidden
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function reportByStage(
|
||||
string $dateFilter,
|
||||
?string $dateFrom = null,
|
||||
@@ -307,6 +319,10 @@ class Opportunity extends Record
|
||||
return (object) $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Forbidden
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function reportSalesByMonth(
|
||||
string $dateFilter,
|
||||
?string $dateFrom = null,
|
||||
@@ -447,9 +463,9 @@ class Opportunity extends Record
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $dateFilter
|
||||
* @return array{string,string}
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function getDateRangeByFilter(string $dateFilter): array
|
||||
{
|
||||
@@ -578,6 +594,7 @@ class Opportunity extends Record
|
||||
|
||||
/**
|
||||
* @return stdClass[]
|
||||
* @throws \Espo\Core\Exceptions\Forbidden
|
||||
*/
|
||||
public function getEmailAddressList(string $id): array
|
||||
{
|
||||
|
||||
@@ -311,6 +311,7 @@ class TargetList extends Record implements
|
||||
|
||||
/**
|
||||
* @return RecordCollection<Entity>
|
||||
* @throws Error
|
||||
*/
|
||||
protected function findLinkedOptedOut(string $id, SearchParams $searchParams): RecordCollection
|
||||
{
|
||||
@@ -370,6 +371,10 @@ class TargetList extends Record implements
|
||||
return new RecordCollection($collection, $totalCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws NotFound
|
||||
* @throws Error
|
||||
*/
|
||||
public function optOut(string $id, string $targetType, string $targetId): void
|
||||
{
|
||||
$targetList = $this->entityManager->getEntity('TargetList', $id);
|
||||
@@ -406,6 +411,10 @@ class TargetList extends Record implements
|
||||
$this->hookManager->process('TargetList', 'afterOptOut', $targetList, [], $hookData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws NotFound
|
||||
* @throws Error
|
||||
*/
|
||||
public function cancelOptOut(string $id, string $targetType, string $targetId): void
|
||||
{
|
||||
$targetList = $this->entityManager->getEntity('TargetList', $id);
|
||||
|
||||
@@ -459,7 +459,9 @@ class Email extends Record implements
|
||||
/**
|
||||
* @throws BadRequest
|
||||
* @throws Error
|
||||
* @throws \Espo\Core\Exceptions\ForbiddenSilent
|
||||
* @throws \Espo\Core\Exceptions\Forbidden
|
||||
* @throws \Espo\Core\Exceptions\Conflict
|
||||
* @throws \Espo\Core\Exceptions\BadRequest
|
||||
*/
|
||||
public function create(stdClass $data, CreateParams $params): Entity
|
||||
{
|
||||
|
||||
@@ -312,6 +312,7 @@ class Pdf
|
||||
* Generate PDF. ACL check is processed if `$params` is null.
|
||||
*
|
||||
* @throws Error
|
||||
* @throws Forbidden
|
||||
*/
|
||||
public function generate(Entity $entity, Template $template, ?Params $params = null, ?Data $data = null): string
|
||||
{
|
||||
@@ -329,6 +330,7 @@ class Pdf
|
||||
/**
|
||||
* @param ?array<string,mixed> $additionalData
|
||||
* @throws Error
|
||||
* @throws Forbidden
|
||||
* @deprecated
|
||||
*/
|
||||
public function buildFromTemplate(
|
||||
|
||||
@@ -135,6 +135,9 @@ class FieldManager
|
||||
/**
|
||||
* @param array<string,mixed> $fieldDefs
|
||||
* @return bool
|
||||
* @throws BadRequest
|
||||
* @throws Conflict
|
||||
* @throws Error
|
||||
*/
|
||||
public function create(string $scope, string $name, array $fieldDefs)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user