cakephp

Using Curl & Powershell to POST Form Data to CakePHP

CakePHP 2 Form and trying to POST to it using curl This is what I am trying to duplicate with curl -----------------------------1993502965129257581246610166 Content-Disposition: form-data; name="_method" POST -----------------------------1993502965129257581246610166...

CakePHP/Queue WorkerListener Example Class

This is an example of implementing a WorkerListener class for the new CakePHP/Queue plugin as mentioned here => https://book.cakephp.org/queue/1/en/index.html#worker-events Config array // ... 'Queue' => [ 'default' => [ // A DSN for your configured backend. default:...

Encrypt / Decrypt the columns of your CakePHP 4 DB

https://stackoverflow.com/a/32261210/9230077 The above is a good solution, but it needed updating to work with CakePHP 4 I have updated the above as below to encrypt a database field with a base64 encoded encrypted string The base64 encoding is so it can save in a...

CakePHP 4 has Deprecated File & Folder

So recently my code editor has been putting a line through File because it is going to removed in CakePHP 5 So here is an example of code that uses the deprecated methods and the suggested SplFileObject Using File public function createTempFile($print_content,...

Format validationsErrors

A recursive function that takes a validation error array and return a string with all the different errors concatenated into a formatted string Further to my previous posting https://toggen.com.au/it-tips/cakephp-2-displaying-validation-errors This function will walk...

Embed Create React App SPA into CakePHP 3.8.x view

Some small changes from the old CRA version 2.x the asset-manifest.json now has an entrypoints key // view code src/Template/Assigned/schedule_edit.ctp <?php foreach ($css as $style) : ?> <?= $this->Html->css('/react' . $style, [ 'block' => true ]); ?> <?php...

CakePHP POST Failing

I was just trying to submit about 10 x 15 records... and found that cakephp was failing with a validation error. Found out it was due to the following in the php error log. [09-Jun-2016 19:16:22 Australia/Melbourne] PHP Warning:  Unknown: Input variables exceeded...

CakePHP 3 – Escape to the Global Namespace

This code in CakePHP 3: <?php $date = '31/01/1973'; $ymd = DateTime::createFromFormat('!d/m/Y', $date)->format('Y-m-d'); Causes this error Error: Class 'App\Controller\DateTime' not found This code fixes it: <?php $date = '31/01/1973'; $ymd =...