protected function addFilterByColBetween(Column $col) { $script = ''; if ($col->isNumericType() || $col->isTemporalType()) { $colPhpName = $col->getPhpName(); $variableName = $col->getCamelCaseName(); $queryClassName = $this->getQueryClassName(); $script .= <<<SCRIPT /** * Applies SprykerCriteria::BETWEEN filtering criteria for the column. * * @param array \${$variableName} Filter value. * [ * 'min' => 3, 'max' => 5 * ] * * 'min' and 'max' are optional, when neither is specified, throws \\Spryker\\Zed\\Propel\\Business\\Exception\\AmbiguousComparisonException. * * @return \$this|{$queryClassName} The current query, for fluid interface */ public function filterBy{$colPhpName}_Between(array \${$variableName}) { return \$this->filterBy{$colPhpName}(\${$variableName}, SprykerCriteria::BETWEEN); } SCRIPT; } return $script; }
/** * @dataProvider provideMappingNumericTypes */ public function testNumericType($mappingType, $phpType, $isPrimitiveNumericType) { $domain = $this->getDomainMock(); $domain->expects($this->once())->method('setType')->with($this->equalTo($mappingType)); $domain->expects($this->any())->method('getType')->will($this->returnValue($mappingType)); $column = new Column(); $column->setDomain($domain); $column->setType($mappingType); $this->assertSame($phpType, $column->getPhpType()); $this->assertTrue($column->isPhpPrimitiveType()); $this->assertSame($isPrimitiveNumericType, $column->isPhpPrimitiveNumericType()); $this->assertTrue($column->isNumericType()); }