Skip to content

Commit

Permalink
Fix cakephp fortunes failure (#5232)
Browse files Browse the repository at this point in the history
* Fix fortunes failure

* slight opt

* [ci skip] Fix spaces
  • Loading branch information
jcheron authored and NateBrady23 committed Nov 12, 2019
1 parent 53c41de commit 1608ad5
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions frameworks/PHP/cakephp/src/Controller/FortunesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace App\Controller;

use App\Model\Entity\Fortune;
use Cake\ORM\TableRegistry;

class FortunesController extends AppController {

public function index() {
$this->viewBuilder()->setLayout('fortunes');
$this->loadModel('Fortune');
$viewBuilder = $this->viewBuilder();
$viewBuilder->setLayout('fortunes');
$viewBuilder->setTemplate('/Fortunes/index');

$fortunesTable = TableRegistry::getTableLocator()->get('Fortune');

Expand All @@ -21,15 +21,15 @@ public function index() {



// stuffing in the dynamic data
$fortune = TableRegistry::getTableLocator()->get('Fortune')->newEntity([
'id' => 0,
'message' => 'Additional fortune added at request time.'
]);
// stuffing in the dynamic data
$fortune = $fortunesTable->newEntity([
'id' => 0,
'message' => 'Additional fortune added at request time.'
]);

$fortunes = $fortunes->appendItem($fortune);
$fortunes = $fortunes->appendItem($fortune);

$fortunes = $fortunes->sortBy('message', SORT_ASC, SORT_STRING)->compile(false);
$fortunes = $fortunes->sortBy('message', SORT_ASC, SORT_STRING)->compile(false);

$this->set('fortunes', $fortunes);
}
Expand Down

0 comments on commit 1608ad5

Please sign in to comment.