From 71eb873971a71b17220b8f398978221e94968535 Mon Sep 17 00:00:00 2001 From: Scott Kingsley Clark Date: Fri, 22 Mar 2024 21:39:39 -0500 Subject: [PATCH] Messages implementation fix --- src/Pods/REST/V1/Post_Repository.php | 2 +- src/Pods/REST/V1/Service_Provider.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Pods/REST/V1/Post_Repository.php b/src/Pods/REST/V1/Post_Repository.php index 4ac6e7124c..fed02d84be 100644 --- a/src/Pods/REST/V1/Post_Repository.php +++ b/src/Pods/REST/V1/Post_Repository.php @@ -31,7 +31,7 @@ class Post_Repository { * * @param Messages_Interface|null $messages The messages object. */ - public function __construct( Messages_Interface $messages = null ) { + public function __construct( ?Messages_Interface $messages = null ) { $this->types_get_map = [ '_pods_pod' => [ $this, 'get_pod_data' ], '_pods_group' => [ $this, 'get_group_data' ], diff --git a/src/Pods/REST/V1/Service_Provider.php b/src/Pods/REST/V1/Service_Provider.php index 9a19e9f2c2..6ce046bb80 100644 --- a/src/Pods/REST/V1/Service_Provider.php +++ b/src/Pods/REST/V1/Service_Provider.php @@ -40,11 +40,13 @@ public function register() { $this->container->singleton( 'pods.rest-v1.main', Main::class ); $this->container->singleton( 'pods.rest-v1.messages', Messages::class ); $this->container->singleton( 'pods.rest-v1.validator', Base_Validator::class ); - $this->container->singleton( 'pods.rest-v1.repository', Post_Repository::class ); - $messages = pods_container( 'pods.rest-v1.messages' ); + $messages = pods_container( 'pods.rest-v1.messages' ); + $validator = pods_container( 'pods.rest-v1.validator' ); + + $this->container->singleton( 'pods.rest-v1.repository', new Post_Repository( $messages ) ); + $post_repository = pods_container( 'pods.rest-v1.repository' ); - $validator = pods_container( 'pods.rest-v1.validator' ); $endpoints = $this->get_endpoints();