deprecations

This commit is contained in:
Yuri Kuznetsov
2023-07-01 22:09:41 +03:00
parent dda95dd741
commit 8b8d08afaa
7 changed files with 18 additions and 59 deletions

View File

@@ -373,9 +373,7 @@ class SelectManager
return;
}
$relDefs = $this->getSeed()->getRelations();
$relationType = $seed->getRelationType($link);
$relDefs = $this->entityManager->getMetadata()->get($this->entityType, ['relations']);
$defs = $relDefs[$link];
@@ -455,7 +453,7 @@ class SelectManager
public function applyInCategory(string $link, $value, array &$result)
{
$relDefs = $this->getSeed()->getRelations();
$relDefs = $this->entityManager->getMetadata()->get($this->entityType, ['relations']);
if (empty($relDefs[$link])) {
throw new Error("Can't apply inCategory for link {$link}.");

View File

@@ -630,7 +630,7 @@ class BaseEntity implements Entity
*/
public function getAttributeList(): array
{
return array_keys($this->getAttributes());
return array_keys($this->attributes);
}
/**
@@ -638,21 +638,12 @@ class BaseEntity implements Entity
*/
public function getRelationList(): array
{
return array_keys($this->getRelations());
return array_keys($this->relations);
}
/**
* @deprecated As of v6.0. Use `getValueMap`.
* @return array<string, mixed>
*/
public function getValues()
{
return $this->toArray();
}
/**
* @deprecated As of v6.0. Use `getValueMap`.
* @todo Make protected.
* @todo Remove in v9.0.
* @return array<string, mixed>
*/
public function toArray()
@@ -686,33 +677,6 @@ class BaseEntity implements Entity
return (object) $array;
}
/**
* @deprecated As of v6.0. Use ORM\Defs instead.
* @return array<string, mixed>
*/
public function getFields()
{
return $this->getAttributes();
}
/**
* @deprecated As of v7.0. Use ORM\Defs instead.
* @return array<string, mixed>
*/
public function getAttributes()
{
return $this->attributes;
}
/**
* @deprecated As of v7.0. Use ORM\Defs instead.
* @return array<string, mixed>
*/
public function getRelations()
{
return $this->relations;
}
/**
* Get an attribute type.
*/

View File

@@ -360,11 +360,10 @@ class EntityCollection implements Collection, Iterator, Countable, ArrayAccess,
$arr = [];
foreach ($this as $entity) {
if ($itemsAsObjects) {
$item = $entity->getValueMap();
}
else {
$item = $entity->toArray(); // @phpstan-ignore-line
$item = $entity->getValueMap();
if (!$itemsAsObjects) {
$item = get_object_vars($item);
}
$arr[] = $item;

View File

@@ -139,6 +139,7 @@ class SthCollection implements Collection, IteratorAggregate, Countable
/**
* @deprecated As of v6.0. Use `getValueMapList`.
* @todo Remove in v9.0.
* @return array<int, array<string, mixed>>|stdClass[]
*/
public function toArray(bool $itemsAsObjects = false): array
@@ -146,14 +147,10 @@ class SthCollection implements Collection, IteratorAggregate, Countable
$arr = [];
foreach ($this as $entity) {
if ($itemsAsObjects) {
$item = $entity->getValueMap();
}
else if (method_exists($entity, 'toArray')) {
$item = $entity->toArray();
}
else {
$item = get_object_vars($entity->getValueMap());
$item = $entity->getValueMap();
if (!$itemsAsObjects) {
$item = get_object_vars($item);
}
$arr[] = $item;
@@ -171,7 +168,6 @@ class SthCollection implements Collection, IteratorAggregate, Countable
return $this->toArray(true);
}
/**
* Whether is fetched from DB. SthCollection is always fetched.
*/

View File

@@ -243,9 +243,9 @@ class Preferences implements Repository,
throw new RuntimeException("ID is not set.");
}
$this->data[$entity->getId()] = $entity->toArray();
$this->data[$entity->getId()] = get_object_vars($entity->getValueMap());
$fields = $fields = $this->metadata->get('entityDefs.Preferences.fields');
$fields = $this->metadata->get('entityDefs.Preferences.fields');
$data = [];

View File

@@ -110,6 +110,7 @@ class EmailAccount extends Record implements
* @throws NoSmtp
* @internal Left for bc.
* @deprecated As of v7.3. Use Espo\Core\Mail\Account\PersonalAccount.
* @todo Remove in v9.0.
*/
public function getSmtpParamsFromAccount(EmailAccountEntity $emailAccount): ?array
{

View File

@@ -80,6 +80,7 @@ class InboundEmail extends RecordService implements
* @throws NoSmtp
* @internal Left for bc.
* @deprecated
* @todo Remove in v9.0.
*/
public function getSmtpParamsFromAccount(InboundEmailEntity $emailAccount): ?array
{