Skip to content
This repository
Browse code

Fixed CS

  • Loading branch information...
commit 35f9ab1d12d5e095caa24193be0915922f3b6339 1 parent a22555f
William Durand willdurand authored
1  src/Propel/Generator/Behavior/Versionable/VersionableBehaviorObjectBuilderModifier.php
@@ -205,6 +205,7 @@ public function isVersioningNecessary(\$con = null)
205 205 foreach (\$this->get{$fkGetter}(null, \$con) as \$relatedObject) {
206 206 if (\$relatedObject->isVersioningNecessary(\$con)) {
207 207 \$this->alreadyInSave = false;
  208 +
208 209 return true;
209 210 }
210 211 }
14 src/Propel/Generator/Builder/Om/AbstractObjectBuilder.php
@@ -59,14 +59,14 @@ protected function addColumnAccessorMethods(&$script)
59 59 // if they're not using the DateTime class than we will generate "compatibility" accessor method
60 60 if ($col->getType() === PropelTypes::DATE || $col->getType() === PropelTypes::TIME || $col->getType() === PropelTypes::TIMESTAMP) {
61 61 $this->addTemporalAccessor($script, $col);
62   - } else if ($col->getType() === PropelTypes::OBJECT) {
  62 + } elseif ($col->getType() === PropelTypes::OBJECT) {
63 63 $this->addObjectAccessor($script, $col);
64   - } else if ($col->getType() === PropelTypes::PHP_ARRAY) {
  64 + } elseif ($col->getType() === PropelTypes::PHP_ARRAY) {
65 65 $this->addArrayAccessor($script, $col);
66 66 if ($col->isNamePlural()) {
67 67 $this->addHasArrayElement($script, $col);
68 68 }
69   - } else if ($col->isEnumType()) {
  69 + } elseif ($col->isEnumType()) {
70 70 $this->addEnumAccessor($script, $col);
71 71 } else {
72 72 $this->addDefaultAccessor($script, $col);
@@ -91,17 +91,17 @@ protected function addColumnMutatorMethods(&$script)
91 91 $this->addLobMutator($script, $col);
92 92 } elseif ($col->getType() === PropelTypes::DATE || $col->getType() === PropelTypes::TIME || $col->getType() === PropelTypes::TIMESTAMP) {
93 93 $this->addTemporalMutator($script, $col);
94   - } else if ($col->getType() === PropelTypes::OBJECT) {
  94 + } elseif ($col->getType() === PropelTypes::OBJECT) {
95 95 $this->addObjectMutator($script, $col);
96   - } else if ($col->getType() === PropelTypes::PHP_ARRAY) {
  96 + } elseif ($col->getType() === PropelTypes::PHP_ARRAY) {
97 97 $this->addArrayMutator($script, $col);
98 98 if ($col->isNamePlural()) {
99 99 $this->addAddArrayElement($script, $col);
100 100 $this->addRemoveArrayElement($script, $col);
101 101 }
102   - } else if ($col->isEnumType()) {
  102 + } elseif ($col->isEnumType()) {
103 103 $this->addEnumMutator($script, $col);
104   - } else if ($col->isBooleanType()) {
  104 + } elseif ($col->isBooleanType()) {
105 105 $this->addBooleanMutator($script, $col);
106 106 } else {
107 107 $this->addDefaultMutator($script, $col);
73 src/Propel/Generator/Builder/Om/ObjectBuilder.php
@@ -157,7 +157,7 @@ protected function getDefaultValueString(Column $col)
157 157 throw new EngineException(sprintf('Default Value "%s" is not among the enumerated values', $val));
158 158 }
159 159 $defaultValue = array_search($val, $valueSet);
160   - } else if ($col->isPhpPrimitiveType()) {
  160 + } elseif ($col->isPhpPrimitiveType()) {
161 161 settype($val, $col->getPhpType());
162 162 $defaultValue = var_export($val, true);
163 163 } elseif ($col->isPhpObjectType()) {
@@ -684,17 +684,17 @@ protected function addApplyDefaultValuesBody(&$script) {
684 684 foreach ($colsWithDefaults as $col) {
685 685 $clo = strtolower($col->getName());
686 686 $defaultValue = $this->getDefaultValueString($col);
687   - if ($col->isTemporalType()) {
688   - $dateTimeClass = $this->getBuildProperty('dateTimeClass');
689   - if (!$dateTimeClass) {
690   - $dateTimeClass = '\DateTime';
691   - }
692   - $script .= "
  687 + if ($col->isTemporalType()) {
  688 + $dateTimeClass = $this->getBuildProperty('dateTimeClass');
  689 + if (!$dateTimeClass) {
  690 + $dateTimeClass = '\DateTime';
  691 + }
  692 + $script .= "
693 693 \$this->".$clo." = PropelDateTime::newInstance($defaultValue, null, '$dateTimeClass');";
694   - } else {
695   - $script .= "
  694 + } else {
  695 + $script .= "
696 696 \$this->".$clo." = $defaultValue;";
697   - }
  697 + }
698 698 }
699 699 }
700 700
@@ -853,6 +853,7 @@ protected function addTemporalAccessorBody(&$script, Column $col) {
853 853 $script .= "
854 854 if (\$format === null) {";
855 855 $script .= "
  856 +
856 857 return \$this->$clo;
857 858 } else {
858 859 return \$this->$clo !== null ? \$this->{$clo}->format(\$format) : null;
@@ -1775,11 +1776,11 @@ protected function addHasOnlyDefaultValuesBody(&$script) {
1775 1776 foreach ($colsWithDefaults as $col) {
1776 1777
1777 1778 $clo = strtolower($col->getName());
1778   - $accessor = "\$this->$clo";
1779   - if ($col->isTemporalType()) {
1780   - $fmt = $this->getTemporalFormatter($col);
1781   - $accessor = "\$this->$clo && \$this->{$clo}->format('$fmt')";
1782   - }
  1779 + $accessor = "\$this->$clo";
  1780 + if ($col->isTemporalType()) {
  1781 + $fmt = $this->getTemporalFormatter($col);
  1782 + $accessor = "\$this->$clo && \$this->{$clo}->format('$fmt')";
  1783 + }
1783 1784 $script .= "
1784 1785 if ($accessor !== " . $this->getDefaultValueString($col).") {
1785 1786 return false;
@@ -1877,30 +1878,30 @@ protected function addHydrateBody(&$script) {
1877 1878 \$this->$clo = null;
1878 1879 }";
1879 1880 } elseif ($col->isTemporalType()) {
1880   - $dateTimeClass = $this->getBuildProperty('dateTimeClass');
1881   - if (!$dateTimeClass) {
1882   - $dateTimeClass = '\DateTime';
1883   - }
1884   - $handleMysqlDate = false;
1885   - if ($this->getPlatform() instanceof MysqlPlatform) {
1886   - if ($col->getType() === PropelTypes::TIMESTAMP) {
1887   - $handleMysqlDate = true;
1888   - $mysqlInvalidDateString = '0000-00-00 00:00:00';
1889   - } elseif ($col->getType() === PropelTypes::DATE) {
1890   - $handleMysqlDate = true;
1891   - $mysqlInvalidDateString = '0000-00-00';
1892   - }
1893   - // 00:00:00 is a valid time, so no need to check for that.
1894   - }
1895   - if ($handleMysqlDate) {
1896   - $script .= "
  1881 + $dateTimeClass = $this->getBuildProperty('dateTimeClass');
  1882 + if (!$dateTimeClass) {
  1883 + $dateTimeClass = '\DateTime';
  1884 + }
  1885 + $handleMysqlDate = false;
  1886 + if ($this->getPlatform() instanceof MysqlPlatform) {
  1887 + if ($col->getType() === PropelTypes::TIMESTAMP) {
  1888 + $handleMysqlDate = true;
  1889 + $mysqlInvalidDateString = '0000-00-00 00:00:00';
  1890 + } elseif ($col->getType() === PropelTypes::DATE) {
  1891 + $handleMysqlDate = true;
  1892 + $mysqlInvalidDateString = '0000-00-00';
  1893 + }
  1894 + // 00:00:00 is a valid time, so no need to check for that.
  1895 + }
  1896 + if ($handleMysqlDate) {
  1897 + $script .= "
1897 1898 if (\$row[\$startcol + $n] === '$mysqlInvalidDateString') {
1898 1899 \$row[\$startcol + $n] = null;
1899 1900 }";
1900   - }
1901   - $script .= "
  1901 + }
  1902 + $script .= "
1902 1903 \$this->$clo = (\$row[\$startcol + $n] !== null) ? PropelDateTime::newInstance(\$row[\$startcol + $n], null, '$dateTimeClass') : null;";
1903   - } elseif ($col->isPhpPrimitiveType()) {
  1904 + } elseif ($col->isPhpPrimitiveType()) {
1904 1905 $script .= "
1905 1906 \$this->$clo = (\$row[\$startcol + $n] !== null) ? (".$col->getPhpType().") \$row[\$startcol + $n] : null;";
1906 1907 } elseif ($col->getType() == PropelTypes::OBJECT) {
@@ -4314,7 +4315,7 @@ protected function addDoInsertBodyWithIdMethod()
4314 4315 // remove pkey col since this table uses auto-increment and passing a null value for it is not valid
4315 4316 \$criteria->remove($colConst);";
4316 4317 }
4317   - } else if (!$this->getPlatform()->supportsInsertNullPk()) {
  4318 + } elseif (!$this->getPlatform()->supportsInsertNullPk()) {
4318 4319 $script .= "
4319 4320 // remove pkey col if it is null since this table does not accept that
4320 4321 if (\$criteria->containsKey($colConst) && !\$criteria->keyContainsValue($colConst) ) {
2  src/Propel/Generator/Command/TestPrepare.php
@@ -101,6 +101,7 @@ protected function buildFixtures($fixturesDir, InputInterface $input, OutputInte
101 101 {
102 102 if (!file_exists($fixturesDir)) {
103 103 $output->writeln(sprintf('<error>Directory "%s" not found.</error>', $fixturesDir));
  104 +
104 105 return;
105 106 }
106 107
@@ -125,6 +126,7 @@ protected function buildFixtures($fixturesDir, InputInterface $input, OutputInte
125 126 file_put_contents($targetFile, $content);
126 127 } else {
127 128 $output->writeln(sprintf('<error>No "%s" file found, skipped.</error>', $sourceFile));
  129 +
128 130 return;
129 131 }
130 132 }
2  src/Propel/Runtime/Map/TableMap.php
@@ -628,7 +628,7 @@ public function hasRelation($name)
628 628 */
629 629 public function getRelation($name)
630 630 {
631   - if (!array_key_exists($name, $this->getRelations())) {
  631 + if (!array_key_exists($name, $this->getRelations())) {
632 632 throw new RelationNotFoundException("Calling getRelation() on an unknown relation: $name");
633 633 }
634 634

0 comments on commit 35f9ab1

Please sign in to comment.
Something went wrong with that request. Please try again.