diff --git a/application/Espo/ORM/BaseEntity.php b/application/Espo/ORM/BaseEntity.php index 2a2a56f7c0..75a7d95570 100644 --- a/application/Espo/ORM/BaseEntity.php +++ b/application/Espo/ORM/BaseEntity.php @@ -645,17 +645,17 @@ class BaseEntity implements Entity /** * Whether an entity type has an attribute defined. */ - public function hasAttribute(string $name): bool + public function hasAttribute(string $attibute): bool { - return isset($this->attributes[$name]); + return isset($this->attributes[$attibute]); } /** * Whether an entity type has a relation defined. */ - public function hasRelation(string $name): bool + public function hasRelation(string $relation): bool { - return isset($this->relations[$name]); + return isset($this->relations[$relation]); } /** @@ -848,6 +848,7 @@ class BaseEntity implements Entity if (!self::areValuesEqual(self::JSON_OBJECT, $v1[$i], $v2[$i])) { return false; } + continue; } diff --git a/application/Espo/ORM/Entity.php b/application/Espo/ORM/Entity.php index e4a57e3c1c..19e247b1eb 100644 --- a/application/Espo/ORM/Entity.php +++ b/application/Espo/ORM/Entity.php @@ -99,4 +99,61 @@ interface Entity * Get an entity type. */ public function getEntityType(): string; + + /** + * Get attribute list defined for an entity type. + */ + public function getAttributeList(): array; + + /** + * Get relation list defined for an entity type. + */ + public function getRelationList(): array; + + /** + * Whether an entity type has an attribute defined. + */ + public function hasAttribute(string $attribute): bool; + + /** + * Whether an entity type has a relation defined. + */ + public function hasRelation(string $relation): bool; + + /** + * Get an attribute type. + */ + public function getAttributeType(string $attribute): ?string; + + /** + * Get a relation type. + */ + public function getRelationType(string $relation): ?string; + + /** + * Whether an entity is new. + */ + public function isNew(): bool; + + /** + * Whether is fetched from DB. + */ + public function isFetched(): bool; + + /** + * Whether an attribute was changed (since syncing with DB). + */ + public function isAttributeChanged(string $name): bool; + + /** + * Get a fetched value of a specific attribute. + * + * @return mixed + */ + public function getFetched(string $attribute); + + /** + * Whether a fetched value is set for a specific attribute. + */ + public function hasFetched(string $attribute): bool; }