Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed CS

  • Loading branch information...
commit 35f9ab1d12d5e095caa24193be0915922f3b6339 1 parent a22555f
@willdurand willdurand authored
View
1  src/Propel/Generator/Behavior/Versionable/VersionableBehaviorObjectBuilderModifier.php
@@ -205,6 +205,7 @@ public function isVersioningNecessary(\$con = null)
foreach (\$this->get{$fkGetter}(null, \$con) as \$relatedObject) {
if (\$relatedObject->isVersioningNecessary(\$con)) {
\$this->alreadyInSave = false;
+
return true;
}
}
View
14 src/Propel/Generator/Builder/Om/AbstractObjectBuilder.php
@@ -59,14 +59,14 @@ protected function addColumnAccessorMethods(&$script)
// if they're not using the DateTime class than we will generate "compatibility" accessor method
if ($col->getType() === PropelTypes::DATE || $col->getType() === PropelTypes::TIME || $col->getType() === PropelTypes::TIMESTAMP) {
$this->addTemporalAccessor($script, $col);
- } else if ($col->getType() === PropelTypes::OBJECT) {
+ } elseif ($col->getType() === PropelTypes::OBJECT) {
$this->addObjectAccessor($script, $col);
- } else if ($col->getType() === PropelTypes::PHP_ARRAY) {
+ } elseif ($col->getType() === PropelTypes::PHP_ARRAY) {
$this->addArrayAccessor($script, $col);
if ($col->isNamePlural()) {
$this->addHasArrayElement($script, $col);
}
- } else if ($col->isEnumType()) {
+ } elseif ($col->isEnumType()) {
$this->addEnumAccessor($script, $col);
} else {
$this->addDefaultAccessor($script, $col);
@@ -91,17 +91,17 @@ protected function addColumnMutatorMethods(&$script)
$this->addLobMutator($script, $col);
} elseif ($col->getType() === PropelTypes::DATE || $col->getType() === PropelTypes::TIME || $col->getType() === PropelTypes::TIMESTAMP) {
$this->addTemporalMutator($script, $col);
- } else if ($col->getType() === PropelTypes::OBJECT) {
+ } elseif ($col->getType() === PropelTypes::OBJECT) {
$this->addObjectMutator($script, $col);
- } else if ($col->getType() === PropelTypes::PHP_ARRAY) {
+ } elseif ($col->getType() === PropelTypes::PHP_ARRAY) {
$this->addArrayMutator($script, $col);
if ($col->isNamePlural()) {
$this->addAddArrayElement($script, $col);
$this->addRemoveArrayElement($script, $col);
}
- } else if ($col->isEnumType()) {
+ } elseif ($col->isEnumType()) {
$this->addEnumMutator($script, $col);
- } else if ($col->isBooleanType()) {
+ } elseif ($col->isBooleanType()) {
$this->addBooleanMutator($script, $col);
} else {
$this->addDefaultMutator($script, $col);
View
73 src/Propel/Generator/Builder/Om/ObjectBuilder.php
@@ -157,7 +157,7 @@ protected function getDefaultValueString(Column $col)
throw new EngineException(sprintf('Default Value "%s" is not among the enumerated values', $val));
}
$defaultValue = array_search($val, $valueSet);
- } else if ($col->isPhpPrimitiveType()) {
+ } elseif ($col->isPhpPrimitiveType()) {
settype($val, $col->getPhpType());
$defaultValue = var_export($val, true);
} elseif ($col->isPhpObjectType()) {
@@ -684,17 +684,17 @@ protected function addApplyDefaultValuesBody(&$script) {
foreach ($colsWithDefaults as $col) {
$clo = strtolower($col->getName());
$defaultValue = $this->getDefaultValueString($col);
- if ($col->isTemporalType()) {
- $dateTimeClass = $this->getBuildProperty('dateTimeClass');
- if (!$dateTimeClass) {
- $dateTimeClass = '\DateTime';
- }
- $script .= "
+ if ($col->isTemporalType()) {
+ $dateTimeClass = $this->getBuildProperty('dateTimeClass');
+ if (!$dateTimeClass) {
+ $dateTimeClass = '\DateTime';
+ }
+ $script .= "
\$this->".$clo." = PropelDateTime::newInstance($defaultValue, null, '$dateTimeClass');";
- } else {
- $script .= "
+ } else {
+ $script .= "
\$this->".$clo." = $defaultValue;";
- }
+ }
}
}
@@ -853,6 +853,7 @@ protected function addTemporalAccessorBody(&$script, Column $col) {
$script .= "
if (\$format === null) {";
$script .= "
+
return \$this->$clo;
} else {
return \$this->$clo !== null ? \$this->{$clo}->format(\$format) : null;
@@ -1775,11 +1776,11 @@ protected function addHasOnlyDefaultValuesBody(&$script) {
foreach ($colsWithDefaults as $col) {
$clo = strtolower($col->getName());
- $accessor = "\$this->$clo";
- if ($col->isTemporalType()) {
- $fmt = $this->getTemporalFormatter($col);
- $accessor = "\$this->$clo && \$this->{$clo}->format('$fmt')";
- }
+ $accessor = "\$this->$clo";
+ if ($col->isTemporalType()) {
+ $fmt = $this->getTemporalFormatter($col);
+ $accessor = "\$this->$clo && \$this->{$clo}->format('$fmt')";
+ }
$script .= "
if ($accessor !== " . $this->getDefaultValueString($col).") {
return false;
@@ -1877,30 +1878,30 @@ protected function addHydrateBody(&$script) {
\$this->$clo = null;
}";
} elseif ($col->isTemporalType()) {
- $dateTimeClass = $this->getBuildProperty('dateTimeClass');
- if (!$dateTimeClass) {
- $dateTimeClass = '\DateTime';
- }
- $handleMysqlDate = false;
- if ($this->getPlatform() instanceof MysqlPlatform) {
- if ($col->getType() === PropelTypes::TIMESTAMP) {
- $handleMysqlDate = true;
- $mysqlInvalidDateString = '0000-00-00 00:00:00';
- } elseif ($col->getType() === PropelTypes::DATE) {
- $handleMysqlDate = true;
- $mysqlInvalidDateString = '0000-00-00';
- }
- // 00:00:00 is a valid time, so no need to check for that.
- }
- if ($handleMysqlDate) {
- $script .= "
+ $dateTimeClass = $this->getBuildProperty('dateTimeClass');
+ if (!$dateTimeClass) {
+ $dateTimeClass = '\DateTime';
+ }
+ $handleMysqlDate = false;
+ if ($this->getPlatform() instanceof MysqlPlatform) {
+ if ($col->getType() === PropelTypes::TIMESTAMP) {
+ $handleMysqlDate = true;
+ $mysqlInvalidDateString = '0000-00-00 00:00:00';
+ } elseif ($col->getType() === PropelTypes::DATE) {
+ $handleMysqlDate = true;
+ $mysqlInvalidDateString = '0000-00-00';
+ }
+ // 00:00:00 is a valid time, so no need to check for that.
+ }
+ if ($handleMysqlDate) {
+ $script .= "
if (\$row[\$startcol + $n] === '$mysqlInvalidDateString') {
\$row[\$startcol + $n] = null;
}";
- }
- $script .= "
+ }
+ $script .= "
\$this->$clo = (\$row[\$startcol + $n] !== null) ? PropelDateTime::newInstance(\$row[\$startcol + $n], null, '$dateTimeClass') : null;";
- } elseif ($col->isPhpPrimitiveType()) {
+ } elseif ($col->isPhpPrimitiveType()) {
$script .= "
\$this->$clo = (\$row[\$startcol + $n] !== null) ? (".$col->getPhpType().") \$row[\$startcol + $n] : null;";
} elseif ($col->getType() == PropelTypes::OBJECT) {
@@ -4314,7 +4315,7 @@ protected function addDoInsertBodyWithIdMethod()
// remove pkey col since this table uses auto-increment and passing a null value for it is not valid
\$criteria->remove($colConst);";
}
- } else if (!$this->getPlatform()->supportsInsertNullPk()) {
+ } elseif (!$this->getPlatform()->supportsInsertNullPk()) {
$script .= "
// remove pkey col if it is null since this table does not accept that
if (\$criteria->containsKey($colConst) && !\$criteria->keyContainsValue($colConst) ) {
View
2  src/Propel/Generator/Command/TestPrepare.php
@@ -101,6 +101,7 @@ protected function buildFixtures($fixturesDir, InputInterface $input, OutputInte
{
if (!file_exists($fixturesDir)) {
$output->writeln(sprintf('<error>Directory "%s" not found.</error>', $fixturesDir));
+
return;
}
@@ -125,6 +126,7 @@ protected function buildFixtures($fixturesDir, InputInterface $input, OutputInte
file_put_contents($targetFile, $content);
} else {
$output->writeln(sprintf('<error>No "%s" file found, skipped.</error>', $sourceFile));
+
return;
}
}
View
2  src/Propel/Runtime/Map/TableMap.php
@@ -628,7 +628,7 @@ public function hasRelation($name)
*/
public function getRelation($name)
{
- if (!array_key_exists($name, $this->getRelations())) {
+ if (!array_key_exists($name, $this->getRelations())) {
throw new RelationNotFoundException("Calling getRelation() on an unknown relation: $name");
}
Please sign in to comment.
Something went wrong with that request. Please try again.