Skip to content

Commit f7d474a

Browse files
authored
Merge pull request #1161 from phalcon/3.2.x
3.2.x
2 parents 3f18cbc + 0f526d5 commit f7d474a

File tree

13 files changed

+123
-17
lines changed

13 files changed

+123
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ This command should display something similar to:
114114
```sh
115115
$ phalcon --help
116116

117-
Phalcon DevTools (3.2.11)
117+
Phalcon DevTools (3.2.12)
118118

119119
Help:
120120
Lists the commands available in Phalcon devtools

scripts/Phalcon/Builder/Scaffold.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ private function _makeLayoutsVolt()
595595

596596
$fileName = Text::uncamelize($this->options->get('fileName'));
597597
$viewPath = $dirPathLayouts . DIRECTORY_SEPARATOR . $fileName . '.volt';
598-
if (!file_exists($viewPath || $this->options->contains('force'))) {
598+
if (!file_exists($viewPath) || $this->options->contains('force')) {
599599

600600
// View model layout
601601
$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, 11, 4, 0];
42+
return [3, 2, 12, 4, 0];
4343
}
4444
}

scripts/Phalcon/Generator/Snippet.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public function getAttributes($type, $visibility, \Phalcon\Db\ColumnInterface $f
167167
/**
168168
*
169169
* @var %s%s%s
170-
* @Column(type="%s"%s, nullable=%s)
170+
* @Column(column="%s", type="%s"%s, nullable=%s)
171171
*/
172172
%s \$%s;
173173
EOD;
@@ -176,6 +176,7 @@ public function getAttributes($type, $visibility, \Phalcon\Db\ColumnInterface $f
176176
$type,
177177
$field->isPrimary() ? PHP_EOL.' * @Primary' : '',
178178
$field->isAutoIncrement() ? PHP_EOL.' * @Identity' : '',
179+
$field->getName(),
179180
$type,
180181
$field->getSize() ? ', length=' . $field->getSize() : '',
181182
$field->isNotNull() ? 'false' : 'true', $visibility, $fieldName).PHP_EOL;

tests/_data/console/app/models/files/TestModel.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@ class TestModel extends \Phalcon\Mvc\Model
88
* @var integer
99
* @Primary
1010
* @Identity
11-
* @Column(type="integer", length=10, nullable=false)
11+
* @Column(column="id", type="integer", length=10, nullable=false)
1212
*/
1313
public $id;
1414

1515
/**
1616
*
1717
* @var string
18-
* @Column(type="string", length=20, nullable=false)
18+
* @Column(column="some-col", type="string", length=20, nullable=false)
1919
*/
2020
public $someCol;
2121

2222
/**
2323
*
2424
* @var string
25-
* @Column(type="string", length=20, nullable=false)
25+
* @Column(column="someCol2", type="string", length=20, nullable=false)
2626
*/
2727
public $someCol2;
2828

2929
/**
3030
*
3131
* @var string
32-
* @Column(type="string", length=20, nullable=false)
32+
* @Column(column="SomeCol3", type="string", length=20, nullable=false)
3333
*/
3434
public $someCol3;
3535

tests/_data/console/app/models/files/TestModel2.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ class TestModel2 extends \Phalcon\Mvc\Model
88
* @var integer
99
* @Primary
1010
* @Identity
11-
* @Column(type="integer", length=10, nullable=false)
11+
* @Column(column="id", type="integer", length=10, nullable=false)
1212
*/
1313
public $id;
1414

1515
/**
1616
*
1717
* @var string
18-
* @Column(type="string", length=45, nullable=false)
18+
* @Column(column="name", type="string", length=45, nullable=false)
1919
*/
2020
public $name;
2121

tests/_data/console/app/models/files/TestModel3.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ class TestModel3 extends \Phalcon\Mvc\Model
88
* @var integer
99
* @Primary
1010
* @Identity
11-
* @Column(type="integer", length=10, nullable=false)
11+
* @Column(column="id", type="integer", length=10, nullable=false)
1212
*/
1313
public $id;
1414

1515
/**
1616
*
1717
* @var string
18-
* @Column(type="string", length=45, nullable=false)
18+
* @Column(column="name", type="string", length=45, nullable=false)
1919
*/
2020
public $name;
2121

tests/_data/console/app/models/files/Testmodel4.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ class Testmodel4 extends \Phalcon\Mvc\Model
88
* @var integer
99
* @Primary
1010
* @Identity
11-
* @Column(type="integer", length=10, nullable=false)
11+
* @Column(column="id", type="integer", length=10, nullable=false)
1212
*/
1313
public $id;
1414

1515
/**
1616
*
1717
* @var string
18-
* @Column(type="string", length=45, nullable=false)
18+
* @Column(column="name", type="string", length=45, nullable=false)
1919
*/
2020
public $name;
2121

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1,test1,"2017-08-29 13:05:41","2017-08-29 13:05:41"
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?php
2+
3+
use Phalcon\Db\Column;
4+
use Phalcon\Db\Index;
5+
use Phalcon\Db\Reference;
6+
use Phalcon\Mvc\Model\Migration;
7+
8+
/**
9+
* Class TestMigrationsMigration_101
10+
*/
11+
class TestMigrationsMigration_102 extends Migration
12+
{
13+
/**
14+
* Define the table structure
15+
*
16+
* @return void
17+
*/
18+
public function morph()
19+
{
20+
$this->morphTable('test_migrations', [
21+
'columns' => [
22+
new Column(
23+
'id',
24+
[
25+
'type' => Column::TYPE_INTEGER,
26+
'unsigned' => true,
27+
'notNull' => true,
28+
'autoIncrement' => true,
29+
'size' => 10,
30+
'first' => true
31+
]
32+
),
33+
new Column(
34+
'name',
35+
[
36+
'type' => Column::TYPE_VARCHAR,
37+
'notNull' => true,
38+
'size' => 45,
39+
'after' => 'id'
40+
]
41+
),
42+
new Column(
43+
'created_at',
44+
[
45+
'type' => Column::TYPE_DATETIME,
46+
'notNull' => true,
47+
'size' => 1,
48+
'after' => 'name'
49+
]
50+
),
51+
new Column(
52+
'updated_at',
53+
[
54+
'type' => Column::TYPE_DATETIME,
55+
'notNull' => true,
56+
'size' => 1,
57+
'after' => 'created_at'
58+
]
59+
)
60+
],
61+
'indexes' => [
62+
new Index('PRIMARY', ['id'], 'PRIMARY')
63+
],
64+
'options' => [
65+
'TABLE_TYPE' => 'BASE TABLE',
66+
'AUTO_INCREMENT' => '2',
67+
'ENGINE' => 'InnoDB',
68+
'TABLE_COLLATION' => 'utf8_general_ci'
69+
],
70+
]
71+
);
72+
}
73+
74+
/**
75+
* Run the migrations
76+
*
77+
* @return void
78+
*/
79+
public function up()
80+
{
81+
$this->batchInsert('test_migrations', [
82+
'id',
83+
'name',
84+
'created_at',
85+
'updated_at'
86+
]
87+
);
88+
}
89+
90+
/**
91+
* Reverse the migrations
92+
*
93+
* @return void
94+
*/
95+
public function down()
96+
{
97+
$this->batchDelete('test_migrations');
98+
}
99+
100+
}

0 commit comments

Comments
 (0)