-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
54,225 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/composer.lock | ||
/phpunit.xml | ||
/vendor | ||
config/Migrations/schema-dump-default.lock |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
# CakePHP-AssociationDebugger | ||
# AssociationsDebugger plugin for CakePHP | ||
|
||
## Installation | ||
|
||
You can install this plugin into your CakePHP application using [composer](https://getcomposer.org). | ||
|
||
The recommended way to install composer packages is: | ||
|
||
``` | ||
composer require your-name-here/AssociationsDebugger | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "zunnu/AssociationsDebugger", | ||
"description": "AssociationsDebugger plugin for CakePHP", | ||
"type": "cakephp-plugin", | ||
"license": "MIT", | ||
"require": { | ||
"cakephp/cakephp": "^3.5" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^5.7.14|^6.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"AssociationsDebugger\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"AssociationsDebugger\\Test\\": "tests/", | ||
"Cake\\Test\\": "vendor/cakephp/cakephp/tests/" | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
use Cake\Core\Configure; | ||
|
||
if (Configure::read('debug')) { | ||
Configure::write('DebugKit.panels', ['AssociationsDebugger.Associations']); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
use Cake\Routing\RouteBuilder; | ||
use Cake\Routing\Router; | ||
use Cake\Routing\Route\DashedRoute; | ||
|
||
Router::plugin( | ||
'AssociationsDebugger', | ||
['path' => '/associations-debugger'], | ||
function (RouteBuilder $routes) { | ||
$routes->connect('/', ['controller' => 'Associations', 'action' => 'index']); | ||
$routes->connect('/:action/*', ['controller' => 'Associations']); | ||
// $routes->scope('/', function ($routes) { | ||
// $routes->connect('/:action/*', ['controller' => 'Associations']); | ||
// }); | ||
|
||
$routes->fallbacks(DashedRoute::class); | ||
} | ||
); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit | ||
colors="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
bootstrap="tests/bootstrap.php" | ||
> | ||
<php> | ||
<ini name="memory_limit" value="-1"/> | ||
<ini name="apc.enable_cli" value="1"/> | ||
</php> | ||
|
||
<!-- Add any additional test suites you want to run here --> | ||
<testsuites> | ||
<testsuite name="AssociationsDebugger"> | ||
<directory>tests/TestCase/</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<!-- Setup a listener for fixtures --> | ||
<listeners> | ||
<listener class="Cake\TestSuite\Fixture\FixtureInjector"> | ||
<arguments> | ||
<object class="Cake\TestSuite\Fixture\FixtureManager"/> | ||
</arguments> | ||
</listener> | ||
</listeners> | ||
|
||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">src/</directory> | ||
</whitelist> | ||
</filter> | ||
|
||
</phpunit> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace AssociationsDebugger\Controller; | ||
|
||
use App\Controller\AppController as BaseController; | ||
|
||
class AppController extends BaseController | ||
{ | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
namespace AssociationsDebugger\Controller; | ||
|
||
use AssociationsDebugger\Controller\AppController; | ||
use Cake\Log\Log; | ||
use AssociationsDebugger\Gate; | ||
|
||
/** | ||
* EnforcerGroupPermissions Controller | ||
* | ||
* @property \Enforcer\Model\Table\EnforcerGroupPermissionsTable $EnforcerGroupPermissions | ||
* | ||
* @method \Enforcer\Model\Entity\EnforcerGroupPermission[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = []) | ||
*/ | ||
class AssociationsController extends AppController | ||
{ | ||
public function initialize() { | ||
parent::initialize(); | ||
$this->Gate = new Gate(); | ||
} | ||
|
||
public function index() { | ||
$this->viewBuilder()->setLayout(false); | ||
$conditions = []; | ||
|
||
// SEARCH | ||
if ($this->request->is('get')) { | ||
if(!empty($this->request->getQueryParams())) { | ||
$data = $this->request->getQueryParams(); | ||
|
||
if(!empty($data['plugins']) && $data['plugins'] !== 'undefined') { | ||
$plugins = explode(',', $data['plugins']); | ||
$conditions['plugins'] = $plugins; | ||
} | ||
|
||
if(!empty($data['associationTypes']) && $data['associationTypes'] !== 'undefined') { | ||
$associationTypes = explode(',', $data['associationTypes']); | ||
$conditions['associationTypes'] = $associationTypes; | ||
} | ||
} | ||
} | ||
|
||
$this->set('associationCollections', $this->Gate->associations($conditions)->array()); | ||
$this->set('associationTypes', $this->Gate->getAssociationTypes()); | ||
$this->set('activePlugins', $this->Gate->getPlugins()); | ||
|
||
if($this->request->is('ajax')) { | ||
$this->render('Element/associationTree'); | ||
} | ||
} | ||
} |
Oops, something went wrong.