Skip to content

Commit

Permalink
Merge branch 'hotfix/fix_runtime_exc_filter_collection' into 'release…
Browse files Browse the repository at this point in the history
…/2.3.0'

Fix runtime exception at filter collection

See merge request metamodels/core!341
  • Loading branch information
zonky2 committed Sep 25, 2024
2 parents 5c04c2f + ad1092f commit 2d1daf7
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 2d1daf7

Please sign in to comment.