How can the integration of a dynamic search query and output contradict the MVC concept in PHP?

The integration of a dynamic search query and output can contradict the MVC concept in PHP if the logic for generating the search query is mixed with the view layer, violating the separation of concerns. To solve this issue, the search query generation should be handled in the model layer, while the view layer should only be responsible for rendering the search results.

// Model (searchModel.php)
class SearchModel {
    public function getSearchResults($searchQuery) {
        // Logic to generate and execute the search query
        return $searchResults;
    }
}

// Controller (searchController.php)
class SearchController {
    public function searchAction() {
        $searchModel = new SearchModel();
        $searchQuery = $_GET['query'];
        $searchResults = $searchModel->getSearchResults($searchQuery);
        
        // Pass search results to the view
        include 'searchView.php';
    }
}

// View (searchView.php)
foreach ($searchResults as $result) {
    echo $result['title'] . '<br>';
}