type fixes

This commit is contained in:
Yuri Kuznetsov
2022-03-10 17:05:30 +02:00
parent 3e8d2f8037
commit ef17859145
4 changed files with 43 additions and 25 deletions
+13 -9
View File
@@ -49,20 +49,17 @@ class Kanban
private const MAX_GROUP_LENGTH = 100;
protected $entityType;
protected ?string $entityType = null;
protected $countDisabled = false;
protected bool $countDisabled = false;
protected $orderDisabled = false;
protected bool $orderDisabled = false;
/**
* @var ?SearchParams
*/
protected $searchParams = null;
protected ?SearchParams $searchParams = null;
protected $userId = null;
protected ?string $userId = null;
protected $maxOrderNumber = self::DEFAULT_MAX_ORDER_NUMBER;
protected int $maxOrderNumber = self::DEFAULT_MAX_ORDER_NUMBER;
private $metadata;
@@ -301,6 +298,10 @@ class Kanban
return $statusField;
}
/**
* @return string[]
* @throws Error
*/
protected function getStatusList(): array
{
$statusField = $this->getStatusField();
@@ -314,6 +315,9 @@ class Kanban
return $statusList;
}
/**
* @return string[]
*/
protected function getStatusIgnoreList(): array
{
return $this->metadata->get(['scopes', $this->entityType, 'kanbanStatusIgnoreList'], []);
@@ -93,6 +93,10 @@ class KanbanService
->getResult();
}
/**
* @param string[] $ids
* @throws ForbiddenSilent
*/
public function order(string $entityType, string $group, array $ids): void
{
$this->processAccessCheck($entityType);
@@ -116,7 +120,7 @@ class KanbanService
return $this->injectableFactory->create(Kanban::class);
}
private function processAccessCheck($entityType): void
private function processAccessCheck(string $entityType): void
{
if (!$this->metadata->get(['scopes', $entityType, 'object'])) {
throw new ForbiddenSilent("Non-object entities are not supported.");
@@ -43,17 +43,17 @@ class OrdererProcessor
private const DEFAULT_MAX_NUMBER = 50;
private $entityType;
private ?string $entityType = null;
private $group;
private ?string $group = null;
private $userId = null;
private ?string $userId = null;
private $maxNumber = self::DEFAULT_MAX_NUMBER;
private int $maxNumber = self::DEFAULT_MAX_NUMBER;
private $entityManager;
private EntityManager $entityManager;
private $metadata;
private Metadata $metadata;
public function __construct(EntityManager $entityManager, Metadata $metadata)
{
@@ -95,6 +95,9 @@ class OrdererProcessor
return $this;
}
/**
* @param string[] $ids
*/
public function order(array $ids): void
{
$this->validate();
+16 -9
View File
@@ -29,27 +29,34 @@
namespace Espo\Tools\Kanban;
use Espo\{
ORM\EntityCollection,
};
use Espo\ORM\EntityCollection;
use StdClass;
use stdClass;
class Result
{
private $collection;
/**
* @var EntityCollection<\Espo\ORM\Entity>
*/
private EntityCollection $collection;
private $total;
private int $total;
private $data;
private stdClass $data;
public function __construct(EntityCollection $collection, int $total, StdClass $data)
/**
* @param EntityCollection<\Espo\ORM\Entity> $collection
*/
public function __construct(EntityCollection $collection, int $total, stdClass $data)
{
$this->collection = $collection;
$this->total = $total;
$this->data = $data;
}
/**
* @return EntityCollection<\Espo\ORM\Entity>
*/
public function getCollection(): EntityCollection
{
return $this->collection;
@@ -60,7 +67,7 @@ class Result
return $this->total;
}
public function getData(): StdClass
public function getData(): stdClass
{
return $this->data;
}