This file contains 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
$venues = $this->PrestigeLogs->PrestigeLogsItems->Venues->find('list')->contain(['Games'])->group(['Games.id'])->toArray(); | |
Creates error: | |
Error: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'camarilla.Venues.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by | |
SQL Query: | |
SELECT Venues.id AS `Venues__id`, Venues.domain_id AS `Venues__domain_id`, Venues.continuity_id AS `Venues__continuity_id`, Venues.game_id AS `Venues__game_id`, Venues.created AS `Venues__created`, Venues.modified AS `Venues__modified`, Games.id AS `Games__id`, Games.parent_id AS `Games__parent_id`, Games.lft AS `Games__lft`, Games.rght AS `Games__rght`, Games.name AS `Games__name`, Games.abbreviation AS `Games__abbreviation`, Games.description AS `Games__description`, Games.created AS `Games__created`, Games.modified AS `Games__modified` FROM venues Venues LEFT JOIN gam |
This file contains 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
//MembershipClassesTable.php | |
namespace App\Model\Table; | |
use Cake\ORM\Table; | |
use Cake\Validation\Validator; | |
use Cake\Model\Behavior\TreeBehavior; | |
class MembershipClassesTable extends AppTable { | |
public function initialize(array $config){ |
This file contains 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 Cake\Routing\Router; | |
Router::scope('/', function($routes) { | |
$routes->connect('/PrestigeLogs', ['controller' => 'PrestigeLogs', 'plugin'=>'Incentives']); | |
} | |
); |
This file contains 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
//From /cam-website/config/bootstrap.php | |
Plugin::load('Incentives', ['bootstrap' => false, 'routes' => true]); | |
//From /cam-website/config/routes.php | |
<?php | |
/** |
This file contains 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 editPrestige($id=null){ | |
$prestigeLog = $this->PrestigeLogs->get($id, | |
['contain'=>[ | |
'Members.Domains', | |
'PrestigeLogsItems'=> function ($q){ | |
return $q->where(['approved_id IS NULL']); | |
} | |
]]); |
This file contains 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
Controller: | |
public function editPrestige($id=null){ | |
$prestigeLog = $this->PrestigeLogs->find() | |
->contain([ | |
'Members.Domains', | |
'PrestigeLogsItems'=> function ($q){ |
This file contains 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
//This is my autocomplete widget | |
<?php | |
namespace App\View\Widget; | |
use Cake\View\Widget\WidgetInterface; | |
use Cake\View\Form\ContextInterface; | |
class Autocomplete implements WidgetInterface { |
This file contains 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 validationDefault(Validator $validator) { | |
return $validator | |
->validatePresence('role_id') | |
->notEmpty('role_id', 'A role is required') | |
->add('role_id', [ | |
'unique' => [ | |
'rule' => function($value, $context){ | |
//debug($context); | |
return $context['data']['isUnique']; |
This file contains 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
// src/Model/Table/ResourcesTable.php | |
namespace App\Model\Table; | |
use Cake\ORM\Table; | |
use Cake\ORM\TableRegistry; | |
use Cake\Validation\Validator; | |
use ReflectionClass; | |
class ResourcesTable extends AppTable { |
This file contains 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
array (size=59) | |
0 => string 'initialize' (length=10) | |
1 => string 'validationDefault' (length=17) | |
2 => string 'initializeDb' (length=12) | |
3 => string '__construct' (length=11) | |
4 => string 'defaultConnectionName' (length=21) | |
5 => string 'table' (length=5) | |
6 => string 'alias' (length=5) | |
7 => string 'connection' (length=10) | |
8 => string 'schema' (length=6) |
NewerOlder