ArrayType.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace Tools\Database\Type;
  3. use Cake\Database\DriverInterface;
  4. use Cake\Database\Type\BaseType;
  5. /**
  6. * Do not convert input on marshal().
  7. */
  8. class ArrayType extends BaseType {
  9. /**
  10. * @param mixed $value
  11. * @return mixed
  12. */
  13. public function marshal($value) {
  14. return $value;
  15. }
  16. /**
  17. * Casts given value from a PHP type to one acceptable by a database.
  18. *
  19. * @param mixed $value Value to be converted to a database equivalent.
  20. * @param \Cake\Database\DriverInterface $driver Object from which database preferences and configuration will be extracted.
  21. * @return mixed Given PHP type casted to one acceptable by a database.
  22. */
  23. public function toDatabase($value, DriverInterface $driver) {
  24. return $value;
  25. }
  26. /**
  27. * Casts given value from a database type to a PHP equivalent.
  28. *
  29. * @param mixed $value Value to be converted to PHP equivalent
  30. * @param \Cake\Database\DriverInterface $driver Object from which database preferences and configuration will be extracted
  31. * @return mixed Given value casted from a database to a PHP equivalent.
  32. */
  33. public function toPHP($value, DriverInterface $driver) {
  34. return $value;
  35. }
  36. }