0

Here is my code and what I'm running into:

// index.php

require "/var/www/functions.php";
use Microsoft\Graph\Graph;
use Microsoft\Graph\Model;
$microsoftGraph = new Graph();

test();



// functions.php

function test($microsoftGraph) {
    $create = $microsoftGraph->createRequest('POST', $create)
    ->setReturnType(Model\Event::class) // This is where I'm having a problem
    ->execute();
}

The error is saying:

PHP Fatal error: Uncaught Error: Class 'Event' not found in...


BUT... if I put the use in my functions.php like this, it works:

use Microsoft\Graph\Graph;
use Microsoft\Graph\Model;

function test($microsoftGraph) {
    $create = $microsoftGraph->createRequest('POST', $create)
    ->setReturnType(Model\Event::class) // This is where I'm having a problem
    ->execute();
}

but how can i "pass" or NOT put use in the functions.php file?

Timmy Balk
  • 238
  • 3
  • 14

0 Answers0