diff --git a/application/Espo/Core/Select/SelectManager.php b/application/Espo/Core/Select/SelectManager.php index 10afd9be44..b940cf828e 100644 --- a/application/Espo/Core/Select/SelectManager.php +++ b/application/Espo/Core/Select/SelectManager.php @@ -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}."); diff --git a/application/Espo/ORM/BaseEntity.php b/application/Espo/ORM/BaseEntity.php index f2e96bf13e..c2c7cda851 100644 --- a/application/Espo/ORM/BaseEntity.php +++ b/application/Espo/ORM/BaseEntity.php @@ -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 - */ - public function getValues() - { - return $this->toArray(); - } - - /** - * @deprecated As of v6.0. Use `getValueMap`. - * @todo Make protected. + * @todo Remove in v9.0. * @return array */ 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 - */ - public function getFields() - { - return $this->getAttributes(); - } - - /** - * @deprecated As of v7.0. Use ORM\Defs instead. - * @return array - */ - public function getAttributes() - { - return $this->attributes; - } - - /** - * @deprecated As of v7.0. Use ORM\Defs instead. - * @return array - */ - public function getRelations() - { - return $this->relations; - } - /** * Get an attribute type. */ diff --git a/application/Espo/ORM/EntityCollection.php b/application/Espo/ORM/EntityCollection.php index af292fad25..67c92d5383 100644 --- a/application/Espo/ORM/EntityCollection.php +++ b/application/Espo/ORM/EntityCollection.php @@ -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; diff --git a/application/Espo/ORM/SthCollection.php b/application/Espo/ORM/SthCollection.php index 6bce5afc8b..59e9e78bdf 100644 --- a/application/Espo/ORM/SthCollection.php +++ b/application/Espo/ORM/SthCollection.php @@ -139,6 +139,7 @@ class SthCollection implements Collection, IteratorAggregate, Countable /** * @deprecated As of v6.0. Use `getValueMapList`. + * @todo Remove in v9.0. * @return array>|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. */ diff --git a/application/Espo/Repositories/Preferences.php b/application/Espo/Repositories/Preferences.php index c63748a5e7..11b3e56011 100644 --- a/application/Espo/Repositories/Preferences.php +++ b/application/Espo/Repositories/Preferences.php @@ -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 = []; diff --git a/application/Espo/Services/EmailAccount.php b/application/Espo/Services/EmailAccount.php index 450c4e458e..a21bebfeea 100644 --- a/application/Espo/Services/EmailAccount.php +++ b/application/Espo/Services/EmailAccount.php @@ -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 { diff --git a/application/Espo/Services/InboundEmail.php b/application/Espo/Services/InboundEmail.php index e0f26bfe9e..747ed33371 100644 --- a/application/Espo/Services/InboundEmail.php +++ b/application/Espo/Services/InboundEmail.php @@ -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 {