/** * {@inheritDoc} * * Postgres wants boolean values converted to the strings 'true'/'false'. */ public function convertBooleans($item) { if (!$this->useBooleanTrueFalseStrings) { return parent::convertBooleans($item); } if (is_array($item)) { foreach ($item as $key => $value) { if (is_bool($value) || is_numeric($item)) { $item[$key] = $value ? 'true' : 'false'; } } } else { if (is_bool($item) || is_numeric($item)) { $item = $item ? 'true' : 'false'; } } return $item; }
/** * {@inheritDoc} * * Postgres wants boolean values converted to the strings 'true'/'false'. */ public function convertBooleans($item) { if (!$this->useBooleanTrueFalseStrings) { return parent::convertBooleans($item); } return $this->doConvertBooleans($item, function ($boolean) { if (null === $boolean) { return 'NULL'; } return true === $boolean ? 'true' : 'false'; }); }
/** * @param mixed $value * @param AbstractPlatform $platform * @return mixed|string */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { return $value ? $platform->convertBooleans($value) : ''; }