Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moved some I18n code to twig

  • Loading branch information...
commit baa6af17f1365a439a8153c514d7e1ff1d49a128 1 parent 7adcd7d
@mpscholten authored
View
33 src/Propel/Generator/Behavior/I18n/I18nBehaviorObjectBuilderModifier.php
@@ -31,30 +31,6 @@ public function __construct($behavior)
$this->table = $behavior->getTable();
}
- public function postDelete($builder)
- {
- $this->builder = $builder;
- if (!$builder->getPlatform()->supportsNativeDeleteTrigger() && !$builder->getBuildProperty('emulateForeignKeyConstraints')) {
- $i18nTable = $this->behavior->getI18nTable();
-
- return $this->behavior->renderTemplate('objectPostDelete', array(
- 'i18nQueryName' => $builder->getClassNameFromBuilder($builder->getNewStubQueryBuilder($i18nTable)),
- 'objectClassName' => $builder->getNewStubObjectBuilder($this->behavior->getTable())->getUnqualifiedClassName(),
- ));
- }
- }
-
- public function objectClearReferences($builder)
- {
- return $this->behavior->renderTemplate('objectClearReferences', array(
- 'defaultLocale' => $this->behavior->getDefaultLocale(),
- ));
- }
-
- public function objectMethods($builder)
- {
- }
-
public function objectFilter(&$script, $builder)
{
$i18nTable = $this->behavior->getI18nTable();
@@ -69,13 +45,4 @@ public function objectFilter(&$script, $builder)
$replacement = "\$0$addition";
$script = preg_replace($pattern, $replacement, $script);
}
-
- protected function isDateType($columnType)
- {
- return in_array($columnType, array(
- PropelTypes::DATE,
- PropelTypes::TIME,
- PropelTypes::TIMESTAMP
- ));
- }
}
View
2  src/Propel/Generator/Behavior/I18n/templates/Object/_clearReferences.php.twig
@@ -0,0 +1,2 @@
+$this->currentLocale = '{{ behavior.defaultLocale }}';
+$this->currentTranslations = null;
View
7 src/Propel/Generator/Behavior/I18n/templates/Object/_hooks/_postDelete.php.twig
@@ -0,0 +1,7 @@
+{% if not builder.platform.supportsNativeDeleteTrigger and not builder.buildProperty('emulateForeignKeyConstraints') %}
+ // emulate delete cascade
+ {{ builder.classNameFromBuilder(builder.newStubQueryBuilder(behavior.i18nTable)) }}::create()
+ ->filterBy{{ builder.newStubObjectBuilder(behavior.table).unqualifiedClassName }}($this)
+ ->delete($con);
+
+{% endif %}
View
2  src/Propel/Generator/Behavior/I18n/templates/objectClearReferences.php
@@ -1,2 +0,0 @@
-$this->currentLocale = '<?= $defaultLocale ?>';
-$this->currentTranslations = null;
View
5 src/Propel/Generator/Behavior/I18n/templates/objectPostDelete.php
@@ -1,5 +0,0 @@
-
-// emulate delete cascade
-<?php echo $i18nQueryName ?>::create()
- ->filterBy<?php echo $objectClassName ?>($this)
- ->delete($con);
Please sign in to comment.
Something went wrong with that request. Please try again.