Error: Using $this when not in object context: Call to a member function get() on null