protected function overrideUsingFilterAndActions() {

		// The post type must have custom-fields support otherwise the meta fields will not appear in the REST API.
		add_post_type_support( $this->post_type, 'custom-fields' );

		add_filter( "rest_{$this->post_type}_query", [ $this, 'overrideQueryArgs' ] );
		add_filter( "rest_prepare_{$this->post_type}", [ $this, 'overrideResponse' ], 10, 3 );
		add_filter( "rest_{$this->post_type}_trashable", [ $this, 'overrideTrashable' ], 10, 2 );
	}
protected function overrideUsingFilterAndActions() {

		// The post type must have custom-fields support otherwise the meta fields will not appear in the REST API.
		add_post_type_support( $this->post_type, 'custom-fields' );

		add_filter( "rest_{$this->post_type}_query", [ $this, 'overrideQueryArgs' ] );
		add_filter( "rest_prepare_{$this->post_type}", [ $this, 'overrideResponse' ], 10, 3 );
		add_filter( "rest_{$this->post_type}_trashable", [ $this, 'overrideTrashable' ], 10, 2 );
	}
protected function overrideUsingFilterAndActions ( ) { // The post type must have custom-fields support otherwise the meta fields will not appear in the REST API. add_post_type_support ( $ this -> post_type , 'custom-fields' ) ; add_filter ( "rest_{$this->post_type}_query" , [ $ this , 'overrideQueryArgs' ] ) ; add_filter ( "rest_prepare_{$this->post_type}" , [ $ this , 'overrideResponse' ] , 10 , 3 ) ; add_filter ( "rest_{$this->post_type}_trashable" , [ $ this , 'overrideTrashable' ] , 10 , 2 ) ; }
Use object inheritance as little as possible to future-proof against WP API changes

With the exception of the abstract \WP_REST_Controller class, the WordPress API documentation
strongly suggests not overriding controllers. Instead we are encouraged to create an entirely separate
controller class for each end point.

Hooks, actions, and `register_rest_field` are fair game.

@see https://developer.wordpress.org/rest-api/extending-the-rest-api/controller-classes/#overview-the-future
Use object inheritance as little as possible to future - proof against WP API changes