Solution: “Undefined Property: primaryKey” in CakePHP 2

File this one under the “facepalm” category… If you ever get this confusing error from CakePHP 2, it almost certainly means you forgot to extend the AppModel class. Undefined property: MyModel::$primaryKey [CORE/Cake/Controller/Scaffold.php, line 131] Undefined property: MyModel::$displayField [CORE/Cake/Controller/Scaffold.php, line 132] Fatal Error Error: Call to undefined method Question::schema() File: lib/Cake/Controller/Scaffold.php Line: 137 The solution is…