Skip to content

Commit

Permalink
Initial cakephp 5 version
Browse files Browse the repository at this point in the history
  • Loading branch information
zunnu committed Jun 15, 2024
1 parent e46e8af commit d599cf4
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"type": "cakephp-plugin",
"license": "MIT",
"require": {
"php": ">=7.2",
"cakephp/cakephp": "^4.0"
"php": ">=8.1",
"cakephp/cakephp": "^5.0.1"
},
"require-dev": {
"phpunit/phpunit": "^8.5 || ^9.3"
"phpunit/phpunit": "^10.1"
},
"autoload": {
"psr-4": {
Expand All @@ -21,4 +21,4 @@
"Cake\\Test\\": "vendor/cakephp/cakephp/tests/"
}
}
}
}
1 change: 0 additions & 1 deletion src/AssociationsDebuggerPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class AssociationsDebuggerPlugin extends BasePlugin
public function bootstrap(PluginApplicationInterface $app): void
{
if (Configure::read('debug')) {
// dd(Configure::read('DebugKit.panels'));
Configure::write('DebugKit.panels', ['AssociationsDebugger.Associations']);
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/Controller/AssociationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
*/
class AssociationsController extends AppController
{
/**
* Gate instance
*
* @var AssociationsDebugger\Gate
*/
protected $Gate;

/**
* initialize method
*
Expand Down
7 changes: 3 additions & 4 deletions src/Gate.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

use Cake\Core\App;
use Cake\Core\Plugin;
use Cake\Filesystem\Folder;
use Cake\ORM\TableRegistry;

class Gate
Expand Down Expand Up @@ -180,7 +179,7 @@ private function _associations($model, $plugin = null)
$activePluginsLower = array_map('strtolower', $this->getPlugins());

if ($associations = $setModel->associations()) {
foreach ($associations->normalizeKeys($associations->getIterator()) as $key => $association) {
foreach ($associations->getIterator() as $key => $association) {
$source = $association->getSource();
$sourceRegistery = 'App';
$targetRegistery = 'App';
Expand Down Expand Up @@ -292,8 +291,8 @@ private function _models($plugin = null)
{
// find the models
$path = $this->getPath($plugin);
$dir = new Folder($path[0]);
$models = $dir->find('.*Table\.php');
$modelsWithPath = glob($path[0] . '/*Table.php');
$models = array_map('basename', $modelsWithPath);

return $models;
}
Expand Down
2 changes: 1 addition & 1 deletion src/View/Helper/StructureBuilderHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class StructureBuilderHelper extends Helper
*
* @var array
*/
protected $_defaultConfig = [
protected array $_defaultConfig = [
'showDeepChildren' => true,
];

Expand Down
4 changes: 2 additions & 2 deletions templates/element/associationTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
if (!isset($showDeepChildren)) {
$showDeepChildren = true;
}
$this->StructureBuilder = $this->loadHelper('AssociationsDebugger.StructureBuilder', ['showDeepChildren' => $showDeepChildren]);
$structure = $this->StructureBuilder->build($associationCollections);
$structureBuilder = $this->loadHelper('AssociationsDebugger.StructureBuilder', ['showDeepChildren' => $showDeepChildren]);
$structure = $structureBuilder->build($associationCollections);
?>

<script type="text/javascript">
Expand Down

0 comments on commit d599cf4

Please sign in to comment.