Skip to content

Commit

Permalink
Fix runtime exception at filter collection
Browse files Browse the repository at this point in the history
  • Loading branch information
zonky2 committed Sep 25, 2024
1 parent 5c04c2f commit ad1092f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ services:
- "@database_connection"
- "@metamodels.factory"
- "@router"
- "@request_stack"
tags:
- name: kernel.event_listener
event: dc-general.view.contao2backend.get-global-button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ services:
- "@database_connection"
- "@metamodels.factory"
- "@router"
- "@request_stack"
tags:
- name: kernel.event_listener
event: dc-general.view.contao2backend.get-global-button
Expand Down
8 changes: 6 additions & 2 deletions src/Filter/Setting/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ class Collection implements ICollection
/**
* The attached MetaModel.
*
* @var IMetaModel
* @var IMetaModel|null
*/
protected $metaModel;
protected $metaModel = null;

/**
* Create a new instance.
Expand Down Expand Up @@ -100,6 +100,10 @@ public function setMetaModel($metaModel): self
*/
public function getMetaModel()
{
if (null === $this->metaModel) {
throw new \RuntimeException('Meta model not set');
}

return $this->metaModel;
}

Expand Down

0 comments on commit ad1092f

Please sign in to comment.