NC12 breaking changes?

OK, I think I found it. If someone could confirm that I am not completely off :slight_smile:

	$stmt5 = $this->db->prepare($SQL1);
	$result5 = $stmt5->execute(array($this->userId))->fetchAll();

has to become a

	$stmt5 = $this->db->prepare($SQL1);
	$stmt5->execute(array($this->userId));
	$result5 = $stmt5->fetchAll();

The solution seems to be that I have to execute the prepared statement itself and then perform a fetch (for single) or fetchAll (for all) rows.
The result can then be looped.

correct?

The tutorial app is broken with the same error. I’ve tried to debug based on the info in this thread, but don’t see any deprecated code.

The tutorial, uses ajax to make a call to get notes from the DB. The ajax call is getting a 500, so I’m guessing the issue is with the DB, but from what I can tell, the app is not using the deprecated OCP\IDb. It is using OCP\IDbConnection.

Any ideas? Info about the tutorial below.

Tutorial: https://docs.nextcloud.com/server/12/developer_manual/app/tutorial.html
Code: https://github.com/owncloud/app-tutorial#tutorial
Log error:
OCP\AppFramework\QueryException: Could not resolve AppName! Class AppName does not exist
/Users/curtis/Documents/code/ph-secure-site/lib/private/AppFramework/Utility/SimpleContainer.php - line 117: OC\AppFramework\Utility\SimpleContainer->resolve(‘AppName’)
/Users/curtis/Documents/code/ph-secure-site/lib/private/ServerContainer.php - line 132: OC\AppFramework\Utility\SimpleContainer->query(‘AppName’)
/Users/curtis/Documents/code/ph-secure-site/lib/private/AppFramework/Utility/SimpleContainer.php - line 66: OC\ServerContainer->query(‘AppName’)
/Users/curtis/Documents/code/ph-secure-site/lib/private/AppFramework/Utility/SimpleContainer.php - line 96: OC\AppFramework\Utility\SimpleContainer->buildClass(Object(ReflectionClass))
/Users/curtis/Documents/code/ph-secure-site/lib/private/AppFramework/Utility/SimpleContainer.php - line 117: OC\AppFramework\Utility\SimpleContainer->resolve(‘OCA\OwnNotes\Co…’)
/Users/curtis/Documents/code/ph-secure-site/lib/private/ServerContainer.php - line 132: OC\AppFramework\Utility\SimpleContainer->query(‘OCA\OwnNotes\Co…’)
/Users/curtis/Documents/code/ph-secure-site/lib/private/AppFramework/DependencyInjection/DIContainer.php - line 410: OC\ServerContainer->query(‘OCA\OwnNotes\Co…’)
/Users/curtis/Documents/code/ph-secure-site/lib/private/AppFramework/App.php - line 101: OC\AppFramework\DependencyInjection\DIContainer->query(‘OCA\OwnNotes\Co…’)
/Users/curtis/Documents/code/ph-secure-site/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47: OC\AppFramework\App main(‘OCA\OwnNotes\Co…’, ‘index’, Object(OC\AppFramework\DependencyInjection\DIContainer), Array)
[internal function] OC\AppFramework\Routing\RouteActionHandler->__invoke(Array)
/Users/curtis/Documents/code/ph-secure-site/lib/private/Route/Router.php - line 299: call_user_func(Object(OC\AppFramework\Routing\RouteActionHandler), Array)
/Users/curtis/Documents/code/ph-secure-site/lib/base.php - line 1000: OC\Route\Router->match(’/apps/ownnotes/…’)
/Users/curtis/Documents/code/ph-secure-site/index.php - line 40: OC handleRequest()
{main}

@Curtis try to replace $AppName with $appName in your constructors and see if it works

Thanks. I abandoned the tutorial app. It appears to use a lot of older patterns and it’s not maintained. I just started with the dev pages and have been trying to build out an app from that.

Had some time over the weekend to fork and port the tutorial app fyi https://github.com/nextcloud/app-tutorial