-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from loadsys/f/sniff-rollups
F/sniff rollups
- Loading branch information
Showing
37 changed files
with
853 additions
and
55 deletions.
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 |
---|---|---|
|
@@ -11,3 +11,5 @@ Thumbs.db | |
# Composer | ||
/vendor/* | ||
composer.lock | ||
|
||
/tmp |
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 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 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,26 @@ | ||
<?php | ||
/** | ||
* Hook into the normal baking process to install our own Helper(s) and | ||
* modify the view Vars used for any generated file. | ||
* | ||
* @link http://book.cakephp.org/3.0/en/bake/development.html | ||
*/ | ||
|
||
use Cake\Event\Event; | ||
use Cake\Event\EventManager; | ||
|
||
/** | ||
* Default to the LoadsysTheme and install our own BakeHelper. | ||
*/ | ||
EventManager::instance()->on('Bake.initialize', function (Event $event) { | ||
$view = $event->subject; | ||
|
||
// Use the LoadsysTheme if none was explicitly named. | ||
if (empty($view->theme())) { | ||
$view->theme('LoadsysTheme'); | ||
} | ||
|
||
// Swap in our overridden BakeHelper class. | ||
$view->helpers()->unload('Bake'); | ||
$view->loadHelper('LoadsysTheme.Bake'); | ||
}); |
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,6 +1,6 @@ | ||
<?php | ||
use Cake\Routing\Router; | ||
/** | ||
* Nothing to do currently. | ||
*/ | ||
|
||
Router::plugin('LoadsysTheme', function ($routes) { | ||
$routes->fallbacks('InflectedRoute'); | ||
}); | ||
use Cake\Routing\Router; |
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,17 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="LoadsysTheme"> | ||
<description>Import rules from Loadsys standard.</description> | ||
|
||
<arg value="sp"/> | ||
<arg name="colors"/> | ||
|
||
<!-- Include CakePHP rules (but don't USE them) and Loadsys rules. --> | ||
<rule ref="vendor/cakephp/cakephp-codesniffer/CakePHP/ruleset.xml"> | ||
<exclude name="CakePHP"/> | ||
</rule> | ||
<rule ref="vendor/loadsys/loadsys_codesniffer/Loadsys/ruleset.xml" /> | ||
|
||
<file>./config</file> | ||
<file>./src</file> | ||
<file>./tests</file> | ||
</ruleset> |
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 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 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 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 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 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 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 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 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,12 @@ | ||
<% foreach ($columns as $columnName => $columnAttributes): | ||
$type = $columnAttributes['type']; | ||
unset($columnAttributes['type']); | ||
|
||
$columnAttributes = $this->Migration->getColumnOption($columnAttributes); | ||
$columnAttributes = $this->Migration->stringifyList($columnAttributes, ['indent' => 4]); | ||
if (!empty($columnAttributes)): %> | ||
->addColumn('<%= $columnName %>', '<%= $type %>', [<%= $columnAttributes %>]) | ||
<% else: %> | ||
->addColumn('<%= $columnName %>', '<%= $type %>') | ||
<% endif; %> | ||
<% endforeach; %> |
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,3 @@ | ||
<% foreach ($constraints as $table => $tableConstraints): | ||
echo $this->element('LoadsysTheme.add-foreign-keys', ['constraints' => $tableConstraints, 'table' => $table]); | ||
endforeach; %> |
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,44 @@ | ||
<% | ||
$statement = $this->Migration->tableStatement($table, true); | ||
$hasProcessedConstraint = false; | ||
%> | ||
<% foreach ($constraints as $constraint): | ||
$constraintColumns = $constraint['columns']; | ||
sort($constraintColumns); | ||
if ($constraint['type'] !== 'unique'): | ||
$hasProcessedConstraint = true; | ||
$columnsList = '\'' . $constraint['columns'][0] . '\''; | ||
if (count($constraint['columns']) > 1): | ||
$columnsList = '[' . $this->Migration->stringifyList($constraint['columns'], ['indent' => 5]) . ']'; | ||
endif; | ||
$this->Migration->returnedData['dropForeignKeys'][$table][] = $columnsList; | ||
|
||
if (is_array($constraint['references'][1])): | ||
$columnsReference = '[' . $this->Migration->stringifyList($constraint['references'][1], ['indent' => 5]) . ']'; | ||
else: | ||
$columnsReference = '\'' . $constraint['references'][1] . '\''; | ||
endif; | ||
|
||
if (!isset($statement)): | ||
$statement = $this->Migration->tableStatement($table); | ||
endif; | ||
|
||
if (!empty($statement)): %> | ||
|
||
<%= $statement %> | ||
<% unset($statement); | ||
endif; %> | ||
->addForeignKey( | ||
<%= $columnsList %>, | ||
'<%= $constraint['references'][0] %>', | ||
<%= $columnsReference %>, | ||
[ | ||
'update' => '<%= strtoupper($constraint['update']) %>', | ||
'delete' => '<%= strtoupper($constraint['delete']) %>' | ||
] | ||
) | ||
<% endif; %> | ||
<% endforeach; %> | ||
<% if (isset($this->Migration->tableStatements[$table]) && $hasProcessedConstraint): %> | ||
->update(); | ||
<% endif; %> |
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 @@ | ||
<% foreach ($indexes as $indexName => $index): %> | ||
->addIndex([<% echo $this->Migration->stringifyList($index['columns'], ['indent' => false]); %>], [<% | ||
$params = ['name' => $indexName]; | ||
if ($index['type'] === 'unique'): | ||
$params['unique'] = true; | ||
endif; | ||
echo $this->Migration->stringifyList($params, ['indent' => 4]); | ||
%>]) | ||
<% endforeach; %> |
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
Oops, something went wrong.