CakePHP

Prevent Cron Task Overlap in CakePHP

If you have a task that runs every 5 minutes, and it takes more than 5 minutes to run then the next task will start causing even more server load. This effect may stack up and eventually cause your server to come to a grinding halt. For this reason it is very important that your scheduled tasks do not overlap.

Multiple Primary Keys in CakePHP

If you have ever tried to deal with multiple primary keys in cakePHP then you have probably hit a brick wall at some stage. Although you still need to add a single id field, this example will allow you to save your data without needing to know the id.

Importing Data from CSV into CakePHP

This is a quick little method that lets you get some data from a CSV into a table. It should work with very large CSV files as it only has to read one row at a time.

Auto-Set the ID beforeSave in CakePHP

In this quick snippet of code I will be setting the ID of a model based on other fields given. We want to save a note about each Post that is different for every Client, however we do not want to have to get the ID every time we save the data.

Admin Editable Settings and Theme in CakePHP

Admin Editible Settings and Theme in CakePHP

Usually the client will request for me to give them a way to edit simple settings in their application.

I decided to read all the variables from the database in the beforeFilter to make them available in any controller.

Simple Auth with Users HABTM Groups in CakePHP

In almost every project I need to setup some sort of login, and usually it requires group access to certain data depending on different criteria. For example I may have groups Admin+Member and I want Members to only be able to see other Users Profiles if the other Profile is active.

Fun with Tree Behaviour in CakePHP

I had a play with the Tree Behaviour in CakePHP and was very impressed at what you could create with such ease.

Attach Comments to Any Model in CakePHP

This method of linking models allows you to have a single table of data, say Comment, that is related to any one of a number of other Models (eg: Post, Event).

Working with HABTM Form Data in CakePHP

I would like to document several speedy ways I have of working with HABTM data.

Merge your Add and Edit actions into a Single Form in CakePHP

This CakePHP example will show you how to merge your Add and Edit forms into a Single Form action.

This may be of benefit if you have a form with complex controller logic that you don't want to duplicate.

Syndicate content