diff --git a/composer.json b/composer.json index 54a0508..3c470aa 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "homepage": "https://www.appsdevteam.com", "license": ["MIT"], "require": { - "php": ">=7.4", + "php": ">=8.0", "doctrine/orm": "^2.4", "adt/nette-forms-components": "^1.0", "symfony/property-access": "~3.3 || ^4.0 || ^5.0" diff --git a/src/BaseForm.php b/src/BaseForm.php index 879c12b..8e5a95b 100644 --- a/src/BaseForm.php +++ b/src/BaseForm.php @@ -59,7 +59,7 @@ public function __construct() // we need to call initOnAfterMapToForm last // so we will remove initOnAfterMapToForm, add callbak and add initOnAfterMapToForm again - public function setOnAfterInitForm(callable $onAfterInitForm): self + public function setOnAfterInitForm(callable $onAfterInitForm): static { array_pop($this->onAfterInitForm); $this->onAfterInitForm[] = $onAfterInitForm; @@ -67,19 +67,19 @@ public function setOnAfterInitForm(callable $onAfterInitForm): self return $this; } - public function setOnAfterMapToForm(callable $onAfterMapToForm): self + public function setOnAfterMapToForm(callable $onAfterMapToForm): static { $this->onAfterMapToForm[] = $onAfterMapToForm; return $this; } - public function setOnAfterMapToEntity(callable $onAfterMapToEntity): self + public function setOnAfterMapToEntity(callable $onAfterMapToEntity): static { $this->onAfterMapToEntity[] = $onAfterMapToEntity; return $this; } - final public function setEntity(Entity $entity): self + final public function setEntity(Entity $entity): static { $this->entity = $entity; if (isset($this->components['form'])) { diff --git a/src/Entity.php b/src/Entity.php index 43b2553..5a8c612 100644 --- a/src/Entity.php +++ b/src/Entity.php @@ -5,4 +5,6 @@ interface Entity { public function getId(); + + public function get($field); } diff --git a/src/Form.php b/src/Form.php index 77b723a..b8c74fb 100644 --- a/src/Form.php +++ b/src/Form.php @@ -33,13 +33,13 @@ public function getEntityMapper(): EntityFormMapper return $this->entityMapper; } - public function setEntityManager(EntityManagerInterface $entityManager): self + public function setEntityManager(EntityManagerInterface $entityManager): static { $this->entityManager = $entityManager; return $this; } - public function setEntity(object $entity): self + public function setEntity(object $entity): static { if (!is_object($entity)) { throw new InvalidArgumentException('Expected object, ' . gettype($entity) . ' given.'); @@ -73,7 +73,7 @@ public function getComponentFormMapper(IComponent $component): ?\Closure return $this->componentFormMappers[spl_object_hash($component)] ?? null; } - public function setComponentFormMapper(IComponent $component, \Closure $formMapper): self + public function setComponentFormMapper(IComponent $component, \Closure $formMapper): static { $this->componentFormMappers[spl_object_hash($component)] = $formMapper; return $this; @@ -84,7 +84,7 @@ public function getComponentEntityMapper(IComponent $component): ?\Closure return $this->componentEntityMappers[spl_object_hash($component)] ?? null; } - public function setComponentEntityMapper(IComponent $component, \Closure $entityMapper): self + public function setComponentEntityMapper(IComponent $component, \Closure $entityMapper): static { $this->componentEntityMappers[spl_object_hash($component)] = $entityMapper; return $this; @@ -95,7 +95,7 @@ public function getComponentEntityFactory(IComponent $component): ?\Closure return $this->componentEntityFactories[spl_object_hash($component)] ?? null; } - public function setComponentEntityFactory(IComponent $component, \Closure $entityFactory): self + public function setComponentEntityFactory(IComponent $component, \Closure $entityFactory): static { $this->componentEntityFactories[spl_object_hash($component)] = $entityFactory; return $this;