Skip to content

Commit cd431b7

Browse files
authored
Merge pull request #6 from trurl-master/master
Make it compatible with table modifying behaviors
2 parents e71248a + bab6c17 commit cd431b7

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/PropelJSBehavior.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class PropelJSBehavior extends Behavior
1212
/** @var PluralizerInterface */
1313
protected $pluralizer;
1414

15+
private static $tablesProcessed = 0;
16+
1517
/**
1618
* @return PluralizerInterface
1719
*/
@@ -22,10 +24,18 @@ public function getPluralizer() {
2224

2325
return $this->pluralizer;
2426
}
27+
28+
public function modifyTable()
29+
{
30+
self::$tablesProcessed++;
31+
32+
if (self::$tablesProcessed === count($this->getTables())) {
33+
self::execute();
34+
}
35+
}
2536

26-
public function modifyDatabase()
37+
public function execute()
2738
{
28-
parent::modifyDatabase();
2939

3040
$jsDirectory = getcwd() . '/generated-js';
3141
$apiDirectory = getcwd() . '/generated-api';

src/templates/API.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public static function getAction()
144144
/**
145145
* @return ModelCriteria
146146
*/
147-
public function getQueryOr404()
147+
public static function getQueryOr404()
148148
{
149149
if (static::$query === null) {
150150
$resourceName = static::getResourceName();

0 commit comments

Comments
 (0)