Skip to content

Instantly share code, notes, and snippets.

Brandon Bernal bjlbernal

Block or report user

Report or block bjlbernal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bjlbernal
bjlbernal / 1. Use Controller::afterFilter()
Last active Mar 21, 2016
Cake Events (2.* at least) do not have to block controller logic, and you don't have to have a separate queuing system to process the events. Simply have them handled in the Controller::afterFilter() method. Per cake docs, the Controller::afterFilter() method is called "after the rendering" of the view is complete. This may be a more fragile way…
View 1. Use Controller::afterFilter()
<?php
class AppController extends Controller
{
...
public $afterFilterEvents = array();
public function afterFilter() {
parent:afterFilter();
You can’t perform that action at this time.