Skip to content

Commit 6775406

Browse files
authored
Merge pull request #1091 from phalcon/3.2.x
3.2.3
2 parents cd81da3 + afa7838 commit 6775406

File tree

7 files changed

+19
-17
lines changed

7 files changed

+19
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ $config = [
152152

153153
## Configuration file
154154

155-
By creating **phalcon.json** or any other configuration file called **phalcon** in root project you can set options for all possible commands, for example:
155+
By creating **config.json** or any other configuration file called **config** in root project you can set options for all possible commands, for example:
156156

157157
```json
158158
{

scripts/Phalcon/Builder/Model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ public function build()
273273
foreach ($db->describeReferences($this->options->get('name'), $schema) as $reference) {
274274
$entityNamespace = '';
275275
if ($this->options->contains('namespace')) {
276-
$entityNamespace = $this->options->get('namespace')."\\";
276+
$entityNamespace = $this->options->get('namespace');
277277
}
278278

279279
$refColumns = $reference->getReferencedColumns();
@@ -439,7 +439,7 @@ public function build()
439439
$attributes[] = $this->snippet->getAttributes($type, $useSettersGetters ? 'protected' : 'public', $field, $this->options->has( 'annotate' ), $fieldName);
440440

441441
if ($useSettersGetters) {
442-
$methodName = Utils::camelize($field->getName(). '_-');
442+
$methodName = Utils::camelize($field->getName(), '_-');
443443
$setters[] = $this->snippet->getSetter($fieldName, $type, $methodName);
444444

445445
if (isset($this->_typeMap[$type])) {

scripts/Phalcon/Builder/Scaffold.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
namespace Phalcon\Builder;
2222

2323
use Phalcon\Text;
24+
use Phalcon\Utils;
2425
use Phalcon\Builder\Model as ModelBuilder;
2526
use Phalcon\DI\FactoryDefault;
2627
use Phalcon\Db\Column;
@@ -277,7 +278,7 @@ private function _captureFilterInput($var, $fields, $useGetSetters, $identityFie
277278
}
278279
}
279280

280-
$code .= '$' . Text::camelize($var, '-') . '->';
281+
$code .= '$' . Utils::lowerCamelizeWithDelimiter($var, '-', true) . '->';
281282
if ($useGetSetters) {
282283
$code .= 'set' . Text::camelize($field) . '(' . $fieldCode . ')';
283284
} else {
@@ -307,7 +308,7 @@ private function _assignTagDefaults($var, $fields, $useGetSetters)
307308
$accessor = $field;
308309
}
309310

310-
$code .= '$this->tag->setDefault("' . $field . '", $' . Text::camelize($var, '-') . '->' . $accessor . ');' . PHP_EOL . "\t\t\t";
311+
$code .= '$this->tag->setDefault("' . $field . '", $' . Utils::lowerCamelizeWithDelimiter($var, '-', true) . '->' . $accessor . ');' . PHP_EOL . "\t\t\t";
311312
}
312313

313314
return $code;
@@ -491,10 +492,10 @@ private function _makeController()
491492

492493
$code = str_replace('$fullyQualifiedModelName$', $this->options->get('modelClass'), $code);
493494

494-
$code = str_replace('$singularVar$', '$' . Text::camelize($this->options->get('singular'), '-'), $code);
495+
$code = str_replace('$singularVar$', '$' . Utils::lowerCamelizeWithDelimiter($this->options->get('singular'), '-', true), $code);
495496
$code = str_replace('$singular$', $this->options->get('singular'), $code);
496497

497-
$code = str_replace('$pluralVar$', '$' . Text::camelize($this->options->get('plural'), '-'), $code);
498+
$code = str_replace('$pluralVar$', '$' . Utils::lowerCamelizeWithDelimiter($this->options->get('plural'), '-', true), $code);
498499
$code = str_replace('$plural$', $this->options->get('plural'), $code);
499500

500501
$code = str_replace('$className$', $this->options->get('className'), $code);
@@ -726,7 +727,7 @@ private function _makeViewSearch()
726727
$rowCode .= "\t\t\t" . '<td><?php echo ';
727728
if (!isset($this->options->allReferences[$fieldName])) {
728729
if ($this->options->genSettersGetters) {
729-
$rowCode .= '$' . Text::camelize($this->options->singular, '-') . '->get' . Text::camelize($fieldName) . '()';
730+
$rowCode .= '$' . Utils::lowerCamelizeWithDelimiter($this->options->singular, '-', true) . '->get' . Text::camelize($fieldName) . '()';
730731
} else {
731732
$rowCode .= '$' . $this->options->singular . '->' . $fieldName;
732733
}
@@ -747,7 +748,7 @@ private function _makeViewSearch()
747748
$code = str_replace('$plural$', $this->options->plural, $code);
748749
$code = str_replace('$headerColumns$', $headerCode, $code);
749750
$code = str_replace('$rowColumns$', $rowCode, $code);
750-
$code = str_replace('$singularVar$', '$' . Text::camelize($this->options->singular, '-'), $code);
751+
$code = str_replace('$singularVar$', '$' . Utils::lowerCamelizeWithDelimiter($this->options->singular, '-', true), $code);
751752
$code = str_replace('$pk$', $idField, $code);
752753

753754
if ($this->isConsole()) {
@@ -791,7 +792,7 @@ private function _makeViewSearchVolt()
791792
$rowCode .= "\t\t\t" . '<td>{{ ';
792793
if (!isset($this->options->allReferences[$fieldName])) {
793794
if ($this->options->contains('genSettersGetters')) {
794-
$rowCode .= Text::camelize($this->options->singular, '-') . '.get' . Text::camelize($fieldName) . '()';
795+
$rowCode .= Utils::lowerCamelizeWithDelimiter($this->options->singular, '-', true) . '.get' . Text::camelize($fieldName) . '()';
795796
} else {
796797
$rowCode .= $this->options->singular . '.' . $fieldName;
797798
}
@@ -812,7 +813,7 @@ private function _makeViewSearchVolt()
812813
$code = str_replace('$plural$', $this->options->plural, $code);
813814
$code = str_replace('$headerColumns$', $headerCode, $code);
814815
$code = str_replace('$rowColumns$', $rowCode, $code);
815-
$code = str_replace('$singularVar$', Text::camelize($this->options->singular, '-'), $code);
816+
$code = str_replace('$singularVar$', Utils::lowerCamelizeWithDelimiter($this->options->singular, '-', true), $code);
816817
$code = str_replace('$pk$', $idField, $code);
817818

818819
if ($this->isConsole()) {

scripts/Phalcon/Commands/Builtin/AllModels.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public function getPossibleParams()
4545
{
4646
return [
4747
'config=s' => 'Configuration file [optional]',
48-
'models=s' => 'Models directory [optional]',
4948
'schema=s' => 'Name of the schema. [optional]',
5049
'namespace=s' => "Model's namespace [optional]",
5150
'extends=s' => 'Models extends [optional]',
@@ -56,6 +55,7 @@ public function getPossibleParams()
5655
'relations' => 'Possible relations defined according to convention [optional]',
5756
'fk' => 'Define any virtual foreign keys [optional]',
5857
'directory=s' => 'Base path on which project will be created [optional]',
58+
'output=s' => 'Folder where models are located [optional]',
5959
'mapcolumn' => 'Get some code for map columns [optional]',
6060
'abstract' => 'Abstract Model [optional]',
6161
'help' => 'Shows this help [optional]',
@@ -100,13 +100,13 @@ public function run(array $parameters)
100100
$config = $this->path->getConfig();
101101
}
102102

103-
if (!$this->isReceivedOption('models')) {
103+
if (!$this->isReceivedOption('output')) {
104104
if (!isset($config->application->modelsDir)) {
105105
throw new CommandsException("Builder doesn't know where is the models directory.");
106106
}
107107
$modelsDir = rtrim($config->application->modelsDir, '\\/') . DIRECTORY_SEPARATOR;
108108
} else {
109-
$modelsDir = $this->getOption('models');
109+
$modelsDir = $this->getOption('output');
110110
}
111111

112112
if (false == $this->path->isAbsolutePath($modelsDir)) {

scripts/Phalcon/Commands/DotPhalconMissingException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class DotPhalconMissingException extends CommandsException implements iSelfHeali
3434
const DEFAULT_MESSAGE = "This command must be run inside a Phalcon project with a .phalcon directory.";
3535
const RESOLUTION_PROMPT = "Shall I create the .phalcon directory now? (y/n)";
3636

37-
public function __construct (string $message = self::DEFAULT_MESSAGE , int $code = 0)
37+
public function __construct (string $message = self::DEFAULT_MESSAGE , $code = 0)
3838
{
3939
$this->message = $message;
4040
$this->code = $code;

scripts/Phalcon/Devtools/Version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ class Version extends PhVersion
3939
*/
4040
protected static function _getVersion()
4141
{
42-
return [3, 2, 0, 4, 1];
42+
return [3, 2, 3, 4, 1];
4343
}
4444
}

scripts/Phalcon/Migrations.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,8 @@ private static function connectionSetup($options)
430430
new Column(
431431
'end_time',
432432
[
433-
'type' => 'TIMESTAMP NOT NULL DEFAULT NOW()',
433+
'type' => Column::TYPE_TIMESTAMP,
434+
'notNull' => true,
434435
]
435436
)
436437
],

0 commit comments

Comments
 (0)