This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use App\Controller; | |
class CompaniesController extends AppController { | |
public function index() { | |
try { | |
$this->set('companies', $this->paginate($this->Companies->find())); | |
} catch(\Cake\Network\Exception\NotFoundException $e) { | |
return $this->redirect(['page' => 1] + $this->request->query); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$this | |
->connection() | |
->newQuery() | |
->update('registrations, employees') | |
->set(['registrations.employee_id = employees.id']) | |
->where([ | |
'registrations.employee_id IS NULL', | |
'registrations.employee_number = employees.employee_number', | |
]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Model\Table; | |
trait saveAllTrait { | |
public function saveAll($entities = [], $options = null) { | |
if($options === null) { | |
return array_map([$this, 'save'], $entities); | |
} | |
$saved_entities = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Controller; | |
use App\Controller\AppController; | |
use App\Controller\MyEventListener; | |
class MyController extends AppController { | |
public function initialize() { | |
// this sets up the eventManager, loads Components and the like. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $this->start('registration')?> | |
<?php $template = new StringTemplate(['registration' => $attendee->event->registration_ctp])?> | |
<?= $template->format('registration', Hash::flatten($attendee->toArray()))?> | |
<?php $this->end()?> | |
<?= $this->fetch('registration') ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function initialize() { | |
// ... | |
$this->loadModel('Historico'); | |
// ... | |
} | |
public function add() | |
{ | |
$solicitud = $this->Solicitud->newEntity(); | |
if ($this->request->is('post')) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App; | |
use Cake\Event\Event; | |
use Cake\I18n\I18n; | |
use Cake\Routing\DispatcherFilter; | |
use Locale; | |
class LocaleSessionFilter extends DispatcherFilter | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace App\Controller; | |
class UsersController extends AppController | |
{ | |
public function isAuthorized($user = null) | |
{ | |
$action = $this->request->params['action']; | |
// admin users are allowed all actions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Lib; | |
class QueueWrapper | |
{ | |
static function extract($job) | |
{ | |
$callable = $job->data('callable'); | |
if(is_array($callable) && count($callable) == 2) { | |
$instance = new $callable[0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Shell; | |
use Cake\Console\Shell; | |
use Josegonzalez\CakeQueuesadilla\Queue\Queue; | |
/** | |
* Queue shell command. | |
*/ | |
class QueueShell extends Shell |