Error

HTTP 500 Whoops, looks like something went wrong.

Call to a member function wp_object() on null

Exception

Error

  1. private ?PostsModel $model = null;
  2. public function __construct()
  3. {
  4. parent::__construct();
  5. $this->model = new PostsModel(Timber::get_post()->wp_object());
  6. }
  7. public function indexAction()
  8. {
  9. $this->render("postList.twig", [
  1. <?php
  2. use Components\Posts\PostsController;
  3. (new PostsController())->indexAction();
  4. return;
include('/data/htdocs/colours-dev/www/wp-content/themes/coloursofostrava/index.php') in /data/htdocs/colours-dev/www/wp-includes/template-loader.php (line 132)
  1. *
  2. * @param string $template The path of the template about to be included.
  3. */
  4. do_action( 'wp_before_include_template', $template );
  5. include $template;
  6. } elseif ( current_user_can( 'switch_themes' ) ) {
  7. $theme = wp_get_theme();
  8. if ( $theme->errors() ) {
  9. wp_die( $theme->errors() );
  10. }
require_once('/data/htdocs/colours-dev/www/wp-includes/template-loader.php') in /data/htdocs/colours-dev/www/wp-blog-header.php (line 19)
  1. // Set up the WordPress query.
  2. wp();
  3. // Load the theme template.
  4. require_once ABSPATH . WPINC . '/template-loader.php';
  5. }
require('/data/htdocs/colours-dev/www/wp-blog-header.php') in /data/htdocs/colours-dev/www/index.php (line 17)
  1. * @var bool
  2. */
  3. define( 'WP_USE_THEMES', true );
  4. /** Loads the WordPress Environment and Template */
  5. require __DIR__ . '/wp-blog-header.php';

Stack Trace

Error
Error:
Call to a member function wp_object() on null

  at /data/htdocs/colours-dev/www/wp-content/themes/coloursofostrava/panda/Components/Posts/PostsController.php:21
  at Components\Posts\PostsController->__construct()
     (/data/htdocs/colours-dev/www/wp-content/themes/coloursofostrava/index.php:5)
  at include('/data/htdocs/colours-dev/www/wp-content/themes/coloursofostrava/index.php')
     (/data/htdocs/colours-dev/www/wp-includes/template-loader.php:132)
  at require_once('/data/htdocs/colours-dev/www/wp-includes/template-loader.php')
     (/data/htdocs/colours-dev/www/wp-blog-header.php:19)
  at require('/data/htdocs/colours-dev/www/wp-blog-header.php')
     (/data/htdocs/colours-dev/www/index.php:17)