Guest User

Untitled

a guest
Jun 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. <?php
  2.  
  3. namespace My\Project\Types;
  4.  
  5. use Doctrine\DBAL\Types\Type;
  6. use Doctrine\DBAL\Platforms\AbstractPlatform;
  7.  
  8. /**
  9. * My custom datatype.
  10. */
  11. class MyType extends Type
  12. {
  13. public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
  14. {
  15. // return the SQL used to create your column type. To create a portable column type, use the $platform.
  16. }
  17.  
  18. public function convertToPHPValue($value)
  19. {
  20. // This is executed when the value is read from the database. Make your conversions here.
  21. }
  22.  
  23. public function convertToDatabaseValue($value, AbstractPlatform $platform)
  24. {
  25. // This is executed when the value is written to the database. Make your conversions here, optionally using the $platform.
  26. }
  27. }
Add Comment
Please, Sign In to add comment