controller

JSON

JavaScript Object Notation (JSON) is a text-based way of representing JavaScript object literals, arrays, and scalar data. It is language independent, self-describing, and plain text. It is a good solution for transferring data between systems because it is easy to read, write, and utilize.

CakePHP has built-in functions to serve data as JSON, making it trivial to allow access to data within an application or across the internet.

Disabled Accounts

Sometimes you need to disable a users account, without deleting the account and the information related to that account. That's why previously in Controller and Views there was a user role named "Disabled." You can set the role to Disabled currently, but it doesn't do anything. Now we're going to change that.

Neighbors

In CakePHP 2 there was a handy feature called "neighbors" where you could simply request the neighboring records (previous and next) for easy linking. This is not present since CakePHP 3, possibly due to the limited use of such a feature, however, with custom finders you can replicate the functionality yourself.

Table Relationships

When working with CakePHP it is important to remember "Convention over Configuration." If you start from the bottom, or back end, the database, and work your way forward correctly, CakePHP will do much of legwork for you, saving you tons of redundant and repetitive work.

If you don't, there are almost always ways to make things work the hard way. An example of this is the relationships between tables. If you name your database tables and fields following CakePHP convention, it becomes trivial to set up relationships between them.

Authorization

Currently any logged in user can add new users and edit existing users. We want to add more finely detailed restrictions. For example we want to restrict non-Admins from editing any user but themselves, nor adding any new accounts. Also we want to restrict non-Admins from changing their role from User to Admin.