From 30dec3be52a03b60ec5b085204f7bddf21e4dc21 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Wed, 11 Dec 2019 15:27:57 +0200 Subject: [PATCH] orm intefrace changes and cleanup --- application/Espo/ORM/Entity.php | 6 ++--- application/Espo/ORM/ICollection.php | 1 - application/Espo/ORM/IEntity.php | 26 +++++++--------------- application/Espo/ORM/RepositoryFactory.php | 1 - 4 files changed, 11 insertions(+), 23 deletions(-) diff --git a/application/Espo/ORM/Entity.php b/application/Espo/ORM/Entity.php index 535cc1c97b..2a8c7a0880 100644 --- a/application/Espo/ORM/Entity.php +++ b/application/Espo/ORM/Entity.php @@ -81,7 +81,7 @@ abstract class Entity implements IEntity } } - public function clear($name = null) + public function clear(?string $name = null) { if (is_null($name)) { $this->reset(); @@ -126,7 +126,7 @@ abstract class Entity implements IEntity } } - public function get($name, $params = []) + public function get(string $name, $params = []) { if ($name == 'id') { return $this->id; @@ -148,7 +148,7 @@ abstract class Entity implements IEntity return null; } - public function has($name) + public function has(string $name) { if ($name == 'id') { return !!$this->id; diff --git a/application/Espo/ORM/ICollection.php b/application/Espo/ORM/ICollection.php index 9f99520a4b..aa72e075cb 100644 --- a/application/Espo/ORM/ICollection.php +++ b/application/Espo/ORM/ICollection.php @@ -33,4 +33,3 @@ interface ICollection { } - diff --git a/application/Espo/ORM/IEntity.php b/application/Espo/ORM/IEntity.php index ec985800bc..53230d5531 100644 --- a/application/Espo/ORM/IEntity.php +++ b/application/Espo/ORM/IEntity.php @@ -56,37 +56,27 @@ interface IEntity const HAS_CHILDREN = 'hasChildren'; /** - * Push values from the array. - * E.g. insert values into the bean from a request data. - * @param array $arr Array of field - value pairs - */ - function populateFromArray(array $arr); - - /** - * Resets all fields in the current model. + * Resets all attributes in the current model. */ function reset(); /** - * Set field. + * Set attribute. */ function set($name, $value); /** - * Get field. + * Get attribute. */ - function get($name); + function get(string $name); /** - * Check field is set. + * Check attribute is set. */ - function has($name); + function has(string $name); /** - * Clear field. + * Clear attribute. */ - function clear($name); - + function clear(?string $name); } - - diff --git a/application/Espo/ORM/RepositoryFactory.php b/application/Espo/ORM/RepositoryFactory.php index 658e80ef90..6a37c48aa3 100644 --- a/application/Espo/ORM/RepositoryFactory.php +++ b/application/Espo/ORM/RepositoryFactory.php @@ -65,4 +65,3 @@ class RepositoryFactory $this->defaultRepositoryClassName = $defaultRepositoryClassName; } } -