This commit is contained in:
Yuri Kuznetsov
2022-10-16 17:53:31 +03:00
parent 9d5e1b7d33
commit 331fb69364
44 changed files with 114 additions and 108 deletions

View File

@@ -33,17 +33,15 @@ use Espo\Core\Field\Address\AddressBuilder;
/**
* An address value object. Immutable.
*
* @immutable
*/
class Address
{
private $street = null;
private $city = null;
private $country = null;
private $state = null;
private $postalCode = null;
public function __construct(

View File

@@ -36,11 +36,12 @@ use InvalidArgumentException;
/**
* A currency value object. Immutable.
*
* @immutable
*/
class Currency
{
private string $amount;
private string $code;
/**

View File

@@ -39,11 +39,12 @@ use RuntimeException;
/**
* A date value object. Immutable.
*
* @immutable
*/
class Date implements DateTimeable
{
private string $value;
private DateTimeImmutable $dateTime;
private const SYSTEM_FORMAT = 'Y-m-d';

View File

@@ -39,6 +39,8 @@ use RuntimeException;
/**
* A date-time value object. Immutable.
*
* @immutable
*/
class DateTime implements DateTimeable
{

View File

@@ -29,8 +29,6 @@
namespace Espo\Core\Field;
use Espo\Core\Field\DateTime;
use Espo\Core\Field\Date;
use Espo\Core\Field\DateTime\DateTimeable;
use DateTimeImmutable;
@@ -41,6 +39,8 @@ use RuntimeException;
/**
* A date-time or date. Immutable.
*
* @immutable
*/
class DateTimeOptional implements DateTimeable
{

View File

@@ -35,13 +35,13 @@ use FILTER_VALIDATE_EMAIL;
/**
* An email address value. Immutable.
*
* @immutable
*/
class EmailAddress
{
private string $address;
private bool $isOptedOut = false;
private bool $isInvalid = false;
public function __construct(string $address)

View File

@@ -34,14 +34,13 @@ use RuntimeException;
/**
* An email address group. Contains a list of email addresses. One email address is set as primary.
* If not empty, then there always should be a primary address. Immutable.
*
* @immutable
*/
class EmailAddressGroup
{
/**
* @var EmailAddress[]
*/
/** @var EmailAddress[] */
private array $list = [];
private ?EmailAddress $primary = null;
/**

View File

@@ -33,11 +33,12 @@ use RuntimeException;
/**
* A link value object. Immutable.
*
* @immutable
*/
class Link
{
private string $id;
private ?string $name = null;
public function __construct(string $id)

View File

@@ -33,6 +33,8 @@ use RuntimeException;
/**
* A link-multiple value object. Immutable.
*
* @immutable
*/
class LinkMultiple
{

View File

@@ -33,6 +33,8 @@ use RuntimeException;
/**
* A link-multiple item. Immutable.
*
* @immutable
*/
class LinkMultipleItem
{

View File

@@ -33,13 +33,13 @@ use RuntimeException;
/**
* A link-parent value object. Immutable.
*
* @immutable
*/
class LinkParent
{
private string $entityType;
private string $id;
private ?string $name = null;
public function __construct(string $entityType, string $id)

View File

@@ -33,15 +33,14 @@ use RuntimeException;
/**
* A phone number value. Immutable.
*
* @immutable
*/
class PhoneNumber
{
private string $number;
private ?string $type = null;
private bool $isOptedOut = false;
private bool $isInvalid = false;
public function __construct(string $number)

View File

@@ -34,18 +34,14 @@ use RuntimeException;
/**
* A phone number group. Contains a list of phone numbers. One phone number is set as primary.
* If not empty, then there always should be a primary number. Immutable.
*
* @immutable
*/
class PhoneNumberGroup
{
/**
* @var PhoneNumber[]
*/
/** @var PhoneNumber[] */
private $list = [];
/**
* @var ?PhoneNumber
*/
private $primary = null;
private ?PhoneNumber $primary = null;
/**
* @param PhoneNumber[] $list

View File

@@ -29,10 +29,12 @@
namespace Espo\Core\Record;
/**
* @immutable
*/
class CreateParams
{
private bool $skipDuplicateCheck = false;
private ?string $duplicateSourceId = null;
public function __construct() {}

View File

@@ -29,6 +29,9 @@
namespace Espo\Core\Record;
/**
* @immutable
*/
class DeleteParams
{
public function __construct() {}

View File

@@ -29,6 +29,9 @@
namespace Espo\Core\Record;
/**
* @immutable
*/
class FindParams
{
private bool $noTotal = false;

View File

@@ -29,6 +29,9 @@
namespace Espo\Core\Record;
/**
* @immutable
*/
class ReadParams
{
public function __construct() {}

View File

@@ -29,10 +29,12 @@
namespace Espo\Core\Record;
/**
* @immutable
*/
class UpdateParams
{
private bool $skipDuplicateCheck = false;
private ?int $versionNumber = null;
public function __construct() {}

View File

@@ -33,10 +33,12 @@ use Espo\Core\Select\SearchParams;
use InvalidArgumentException;
/**
* @immutable
*/
class Item
{
private string $orderBy;
private string $order;
private function __construct(string $orderBy, string $order)

View File

@@ -33,20 +33,16 @@ use Espo\Core\Select\SearchParams;
use InvalidArgumentException;
/**
* @immutable
*/
class Params
{
private bool $forbidComplexExpressions = false;
private bool $forceDefault = false;
/**
* @var mixed
*/
/** @var mixed */
private $orderBy = null;
/**
* @var mixed
*/
/** @var mixed */
private $order = null;
private function __construct()

View File

@@ -31,19 +31,16 @@ namespace Espo\Core\Select\Text\Filter;
use Espo\ORM\Query\Part\WhereItem;
/**
* @immutable
*/
class Data
{
private string $filter;
/**
* @var string[]
*/
/** @var string[] */
private array $attributeList;
private bool $skipWildcards = false;
private ?WhereItem $fullTextSearchWhereItem = null;
private bool $forceFullTextSearch = false;
/**

View File

@@ -29,6 +29,9 @@
namespace Espo\Core\Select\Text;
/**
* @immutable
*/
class FilterParams
{
private bool $noFullTextSearch = false;

View File

@@ -33,20 +33,20 @@ use Espo\ORM\Query\Part\Expression;
use InvalidArgumentException;
/**
* @immutable
*/
class Data
{
private Expression $expression;
/**
* @var string[]
*/
private array $fieldList;
/**
* @var string[]
*/
private array $columnList;
/**
* @var Mode::* $mode
*/

View File

@@ -29,6 +29,9 @@
namespace Espo\Core\Select\Text\FullTextSearch\DataComposer;
/**
* @immutable
*/
class Params
{
private function __construct() {}

View File

@@ -31,10 +31,12 @@ namespace Espo\Core\Select\Where;
use InvalidArgumentException;
/**
* @immutable
*/
class Params
{
private bool $applyPermissionCheck = false;
private bool $forbidComplexExpressions = false;
private function __construct()

View File

@@ -29,32 +29,23 @@
namespace Espo\ORM;
/**
* @immutable
*/
class DatabaseParams
{
private ?string $platform = null;
private ?string $host = null;
private ?int $port = null;
private ?string $name = null;
private ?string $username = null;
private ?string $password = null;
private ?string $charset = null;
private ?string $sslCa = null;
private ?string $sslCert = null;
private ?string $sslKey = null;
private ?string $sslCaPath = null;
private ?string $sslCipher = null;
private bool $sslVerifyDisabled = false;
public static function create(): self

View File

@@ -33,6 +33,8 @@ use RuntimeException;
/**
* Delete parameters.
*
* @immutable
*/
class Delete implements Query
{

View File

@@ -33,6 +33,8 @@ use RuntimeException;
/**
* Insert parameters.
*
* @immutable
*/
class Insert implements Query
{

View File

@@ -33,13 +33,14 @@ use RuntimeException;
/**
* LOCK TABLE parameters.
*
* @immutable
*/
class LockTable implements Query
{
use BaseTrait;
public const MODE_SHARE = 'SHARE';
public const MODE_EXCLUSIVE = 'EXCLUSIVE';
/**

View File

@@ -29,18 +29,15 @@
namespace Espo\ORM\Query\Part;
use Espo\ORM\Query\Part\{
WhereItem,
Where\AndGroup,
Where\OrGroup,
Where\Not,
Where\Comparison,
};
use Espo\ORM\Query\Part\Where\AndGroup;
use Espo\ORM\Query\Part\Where\Comparison;
use Espo\ORM\Query\Part\Where\Not;
use Espo\ORM\Query\Part\Where\OrGroup;
use Espo\ORM\Query\Select;
/**
* A util-class for creating items that can be used as a where-clause.
* An util-class for creating items that can be used as a where-clause.
*/
class Condition
{

View File

@@ -35,6 +35,8 @@ use RuntimeException;
/**
* A complex expression. Can be a function or a simple column reference. Immutable.
*
* @immutable
*/
class Expression implements WhereItem
{

View File

@@ -33,13 +33,13 @@ use RuntimeException;
/**
* A join item. Immutable.
*
* @immutable
*/
class Join
{
private string $target;
private ?string $alias = null;
private ?WhereItem $conditions = null;
private function __construct(string $target, ?string $alias = null)

View File

@@ -33,15 +33,15 @@ use RuntimeException;
/**
* An order item. Immutable.
*
* @immutable
*/
class Order
{
public const ASC = 'ASC';
public const DESC = 'DESC';
private Expression $expression;
private bool $isDesc = false;
private function __construct(Expression $expression)

View File

@@ -35,15 +35,13 @@ use Iterator;
/**
* A list of order items.
*
* @immutable
* @implements Iterator<Order>
*/
class OrderList implements Iterator
{
private int $position = 0;
/**
* @var Order[]
*/
/** @var Order[] */
private array $list;
/**

View File

@@ -31,11 +31,12 @@ namespace Espo\ORM\Query\Part;
/**
* A select item. Immutable.
*
* @immutable
*/
class Selection
{
private $expression;
private $alias = null;
private function __construct(Expression $expression, ?string $alias = null)

View File

@@ -36,6 +36,8 @@ use Espo\ORM\Query\Part\{
/**
* AND-group. Immutable.
*
* @immutable
*/
class AndGroup implements WhereItem
{

View File

@@ -40,34 +40,24 @@ use InvalidArgumentException;
/**
* Compares an expression to a value or another expression. Immutable.
*
* @immutable
*/
class Comparison implements WhereItem
{
private const OPERATOR_EQUAL = '=';
private const OPERATOR_NOT_EQUAL = '!=';
private const OPERATOR_GREATER = '>';
private const OPERATOR_GREATER_OR_EQUAL = '>=';
private const OPERATOR_LESS = '<';
private const OPERATOR_LESS_OR_EQUAL = '<=';
private const OPERATOR_LIKE = '*';
private const OPERATOR_NOT_LIKE = '!*';
private const OPERATOR_IN_SUB_QUERY = '=s';
private const OPERATOR_NOT_IN_SUB_QUERY = '!=s';
private string $rawKey;
/**
* @var mixed
*/
/** @var mixed */
private $rawValue;
/**

View File

@@ -29,18 +29,16 @@
namespace Espo\ORM\Query\Part\Where;
use Espo\ORM\Query\Part\{
WhereItem,
};
use Espo\ORM\Query\Part\WhereItem;
/**
* A NOT-operator. Immutable.
*
* @immutable
*/
class Not implements WhereItem
{
/**
* @var array<mixed,mixed>
*/
/** @var array<mixed,mixed> */
private $rawValue = [];
public function getRaw(): array

View File

@@ -33,13 +33,13 @@ use Espo\ORM\Query\Part\WhereItem;
/**
* OR-group. Immutable.
*
* @immutable
*/
class OrGroup implements WhereItem
{
/**
* @var array<mixed,mixed>
*/
/** @var array<mixed,mixed> */
private $rawValue = [];
public function __construct()

View File

@@ -29,12 +29,12 @@
namespace Espo\ORM\Query\Part;
use Espo\ORM\Query\{
Part\Where\AndGroup,
};
use Espo\ORM\Query\Part\Where\AndGroup;
/**
* A where-clause. Immutable.
*
* @immutable
*/
class WhereClause extends AndGroup
{

View File

@@ -30,7 +30,7 @@
namespace Espo\ORM\Query\Part;
/**
* Can used as a where-clause.
* Can be used as a where-clause.
*/
interface WhereItem
{

View File

@@ -39,6 +39,8 @@ use RuntimeException;
/**
* Select parameters.
*
* @immutable
*
* @todo Add validation and normalization.
*/
class Select implements SelectingQuery
@@ -47,7 +49,6 @@ class Select implements SelectingQuery
use BaseTrait;
public const ORDER_ASC = Order::ASC;
public const ORDER_DESC = Order::DESC;
/**

View File

@@ -33,6 +33,8 @@ use RuntimeException;
/**
* Union parameters.
*
* @immutable
*/
class Union implements SelectingQuery
{

View File

@@ -33,6 +33,8 @@ use RuntimeException;
/**
* Update parameters.
*
* @immutable
*/
class Update implements Query
{