Hello Nextcloud community! Iām new here. Iām starting a little pet project using Nextcloud. Iām trying to write an application ( a plugin ) which, as of now, still does nothing. Thatās because I keep getting errors. I have a page, with a link to a resource, this is the code in routes.php whjich links the code to the Controller.
[ānameā => āapplication#updateā, āurlā => ā/note/{id}ā, āverbā => āGETā],
and here the controller:
<?php
namespace OCA\Application\Controller;
use OCP\IRequest;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\Http;
class ApplicationController extends Controller {
public function __construct(string $AppName, IRequest $request){
parent::__construct($AppName, $request);
}
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
*/
public function index() : DataResponse {
}
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
* @param string $snap
*/
public function update($snap) : DataResponse {
}
}
This still does nothing, but it wouldn't even if there was code inside the update function, because I keep getting this error:
{"reqId":"*****","level":3,"time":"2020-10-04T15:12:24+00:00","remoteAddr":"*******","user":"--","app":"index","method":"GET","url":"/apps/application/note/123","message":{"Exception":"Exception","Message":"Argument 1 passed to OCP\\User\\Events\\BeforeUserLoggedInEvent::__construct() must be of the type string, null given, called in /var/www/html/lib/private/Server.php on line 554","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/App.php","line":137,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Application\\Controller\\ApplicationController"},"update"]}
Do you have any idea about how to resolve this error? (The application is used by the user)
Thank you very much in advance for your help and patience.