diff --git a/web/modules/custom/my_module/src/Entity/Post.php b/web/modules/custom/my_module/src/Entity/Post.php index 5cd63da..83e9aac 100644 --- a/web/modules/custom/my_module/src/Entity/Post.php +++ b/web/modules/custom/my_module/src/Entity/Post.php @@ -9,6 +9,10 @@ class Post { private $node; public function __construct(NodeInterface $node) { + if ($node->bundle() != 'article') { + throw new \InvalidArgumentException(); + } + $this->node = $node; }