type fixes
This commit is contained in:
@@ -41,18 +41,18 @@ use InvalidArgumentException;
|
||||
*/
|
||||
class Metadata
|
||||
{
|
||||
private $data;
|
||||
|
||||
private $defs;
|
||||
|
||||
private $defsData;
|
||||
|
||||
private $dataProvider;
|
||||
|
||||
/**
|
||||
* @var EventDispatcher
|
||||
* @var array<string,mixed>
|
||||
*/
|
||||
private $eventDispatcher;
|
||||
private array $data;
|
||||
|
||||
private Defs $defs;
|
||||
|
||||
private DefsData $defsData;
|
||||
|
||||
private MetadataDataProvider $dataProvider;
|
||||
|
||||
private EventDispatcher $eventDispatcher;
|
||||
|
||||
public function __construct(MetadataDataProvider $dataProvider, ?EventDispatcher $eventDispatcher = null)
|
||||
{
|
||||
@@ -89,6 +89,11 @@ class Metadata
|
||||
|
||||
/**
|
||||
* Get a parameter or parameters by key. Key can be a string or array path.
|
||||
*
|
||||
* @param string $entityType An entity type.
|
||||
* @param string[]|string|null $key A Key.
|
||||
* @param mixed $default A default value. *
|
||||
* @return mixed
|
||||
*/
|
||||
public function get(string $entityType, $key = null, $default = null)
|
||||
{
|
||||
@@ -124,7 +129,10 @@ class Metadata
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string,mixed> $data
|
||||
* @param string[]|string|null $key
|
||||
* @param mixed $default A default value.
|
||||
* @return mixed
|
||||
*/
|
||||
private static function getValueByKey(array $data, $key = null, $default = null)
|
||||
{
|
||||
|
||||
@@ -34,5 +34,8 @@ namespace Espo\ORM;
|
||||
*/
|
||||
interface MetadataDataProvider
|
||||
{
|
||||
/**
|
||||
* @return array<string,mixed>
|
||||
*/
|
||||
public function get(): array;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ trait BaseBuilderTrait
|
||||
{
|
||||
/**
|
||||
* Must be protected for compatibility reasons.
|
||||
*
|
||||
* @var array<string,mixed>
|
||||
*/
|
||||
protected $params = [];
|
||||
|
||||
|
||||
@@ -31,10 +31,15 @@ namespace Espo\ORM\Query;
|
||||
|
||||
trait BaseTrait
|
||||
{
|
||||
/**
|
||||
* @var array<string,mixed>
|
||||
*/
|
||||
private $params = [];
|
||||
|
||||
/**
|
||||
* Get parameters in RAW format.
|
||||
*
|
||||
* @return array<string,mixed>
|
||||
*/
|
||||
public function getRaw(): array
|
||||
{
|
||||
@@ -43,6 +48,8 @@ trait BaseTrait
|
||||
|
||||
/**
|
||||
* Create from RAW params.
|
||||
*
|
||||
* @param array<string,mixed> $params
|
||||
*/
|
||||
public static function fromRaw(array $params): self
|
||||
{
|
||||
@@ -55,6 +62,9 @@ trait BaseTrait
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string,mixed> $params
|
||||
*/
|
||||
private function validateRawParams(array $params): void
|
||||
{
|
||||
}
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
|
||||
namespace Espo\ORM\Query;
|
||||
|
||||
use Espo\ORM\Query\Part\WhereClause;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
@@ -65,6 +63,9 @@ class Delete implements Query
|
||||
return $this->params['limit'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string,mixed> $params
|
||||
*/
|
||||
private function validateRawParams(array $params): void
|
||||
{
|
||||
$this->validateRawParamsSelecting($params);
|
||||
|
||||
@@ -38,6 +38,9 @@ class Insert implements Query
|
||||
{
|
||||
use BaseTrait;
|
||||
|
||||
/**
|
||||
* @param array<string,mixed> $params
|
||||
*/
|
||||
private function validateRawParams(array $params): void
|
||||
{
|
||||
$into = $params['into'] ?? null;
|
||||
|
||||
@@ -33,6 +33,9 @@ class InsertBuilder implements Builder
|
||||
{
|
||||
use BaseBuilderTrait;
|
||||
|
||||
/**
|
||||
* @var array<string,mixed>
|
||||
*/
|
||||
protected $params = [];
|
||||
|
||||
/**
|
||||
@@ -73,6 +76,8 @@ class InsertBuilder implements Builder
|
||||
|
||||
/**
|
||||
* What columns to set with values. A list of columns.
|
||||
*
|
||||
* @param string[] $columns
|
||||
*/
|
||||
public function columns(array $columns): self
|
||||
{
|
||||
@@ -83,6 +88,8 @@ class InsertBuilder implements Builder
|
||||
|
||||
/**
|
||||
* What values to insert. A key-value map or a list of key-value maps.
|
||||
*
|
||||
* @param array<string,mixed> $values
|
||||
*/
|
||||
public function values(array $values): self
|
||||
{
|
||||
@@ -93,6 +100,8 @@ class InsertBuilder implements Builder
|
||||
|
||||
/**
|
||||
* Values to set on duplicate key. A key-value map.
|
||||
*
|
||||
* @param array<string,mixed> $updateSet
|
||||
*/
|
||||
public function updateSet(array $updateSet): self
|
||||
{
|
||||
|
||||
@@ -42,6 +42,9 @@ class LockTable implements Query
|
||||
|
||||
public const MODE_EXCLUSIVE = 'EXCLUSIVE';
|
||||
|
||||
/**
|
||||
* @param array<string,mixed> $params
|
||||
*/
|
||||
protected function validateRawParams(array $params): void
|
||||
{
|
||||
if (empty($params['table'])) {
|
||||
|
||||
Reference in New Issue
Block a user