From 66fef6e365cff967439afa5391791aaf58bc07fc Mon Sep 17 00:00:00 2001 From: Bob den Otter Date: Tue, 23 Jun 2020 15:32:59 +0200 Subject: [PATCH] Update ListFieldTrait.php --- src/Entity/ListFieldTrait.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Entity/ListFieldTrait.php b/src/Entity/ListFieldTrait.php index 48fbac12e..9c85c989c 100644 --- a/src/Entity/ListFieldTrait.php +++ b/src/Entity/ListFieldTrait.php @@ -20,6 +20,15 @@ public function count(): int return count($this->getValue()); } + /** + * Makes ListFieldInterface fields .length attribute + * return the number of elements in the field + */ + public function length(): int + { + return $this->count(); + } + public function current(): Field { return $this->fields[$this->iteratorCursor];