Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adapted this fix to new specifications

  • Loading branch information...
commit 7b073a275960452765295a3ef71342c47a53573a 1 parent e7f7c9f
@rvitaliy rvitaliy authored
View
10 generator/lib/builder/om/PHP5ObjectBuilder.php
@@ -1986,8 +1986,16 @@ protected function addDefaultMutator(&$script, Column $col)
// Perform type-casting to ensure that we can use type-sensitive
// checking in mutators.
if ($col->isPhpPrimitiveType()) {
+ if($col->isTextType()) {
+ $script .= "
+ if (\$v !== null) {";
+ } else {
+ $script .= "
+ if (\$v !== null && is_numeric(\$v)) {";
+ }
+
+
$script .= "
- if (\$v !== null) {
\$v = (" . $col->getPhpType() . ") \$v;
}
";
View
14 test/testsuite/generator/builder/om/GeneratedObjectTest.php
@@ -116,13 +116,14 @@ public function testTypeHintingValues()
$a->clear();
- $a->setAge('wrong integer');
+ $a->setAge('2');
+ $this->assertEquals(2, $a->getAge());
$this->assertTrue(is_int($a->getAge()));
$a->clear();
- $a->setAge(true);
- $this->assertTrue(is_int($a->getAge()));
+ $a->setAge('wrong integer');
+ $this->assertTrue(!is_int($a->getAge()));
$a->clear();
@@ -140,13 +141,6 @@ public function testTypeHintingValues()
$a->clear();
$a->setFirstName(true);
$this->assertTrue(is_string($a->getFirstName()));
-
-
- /* php 5.4+ fail generate Notice: Array to string conversion
- $a->clear();
- $a->setFirstName(array());
- $this->assertTrue(is_string($a->getFirstName()));
- */
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.