Slim 2 to Slim 3 method error
<p>I am trying to convert a slim 2 project to slim 3.
I am stucking with a problem.</p>

<p>When  I call my method:
<a href="http://localhost:8000/task_manager/v1/tasks" rel="nofollow noreferrer">http://localhost:8000/task_manager/v1/tasks</a></p>

<p>I get the next error:</p>

<pre><code>Catchable fatal error: Argument 1 passed to authenticate() must 
be an instance of Slim\Route, instance of 
Slim\Http\Request given in 
C:\wamp64\www\task_manager\v1\index.php on line 42.
</code></pre>

<p>How could I fix it? Some help will be appreciated.</p>

<p>Here is my php code:</p>

<pre><code>$app = new  \Slim\App();
...
...

function authenticate(\Slim\Route $route) {
    // Getting request headers

    $headers = apache_request_headers();
    $data = array();
    $app = AppContainer::getInstance();

    // Verifying Authorization Header
    if (isset($headers['Authorization'])) {
        $db = new DbHandler();

        // get the api key
        $api_key = $headers['Authorization'];
        // validating api key
        if (!$db-&gt;isValidApiKey($api_key)) {
            // api key is not present in users table
            $data["error"] = true;
            $data["message"] = "Access Denied. Invalid Api key";
            return echoRespnse(401, $data, $response);
            //$app-&gt;stop();
            return $response-&gt;withStatus(401)-&gt;withBody("Bad Request");
        } else {
            global $user_id;
            // get user primary key id
            $user_id = $db-&gt;getUserId($api_key);
        }
    } else {
        // api key is missing in header
        $data["error"] = true;
        $data["message"] = "Api key is misssing";
        return echoRespnse(400, $data, $response);
    }
}


$app-&gt;get('/tasks', function (Request $request, Response $response) {
            global $user_id;
            $data = array();
            $db = new DbHandler();

            // fetching all user tasks
            $result = $db-&gt;getAllUserTasks($user_id);

            $data["error"] = false;
            $data["tasks"] = array();

            // looping through result and preparing tasks array
            while ($task = $result-&gt;fetch_assoc()) {
                $tmp = array();
                $tmp["id"] = $task["id"];
                $tmp["task"] = $task["task"];
                $tmp["status"] = $task["status"];
                $tmp["createdAt"] = $task["created_at"];
                array_push($data["tasks"], $tmp);
            }

            return echoRespnse(200, $data, $response);
        })-&gt;add('authenticate');
</code></pre>