Skip to content

Instantly share code, notes, and snippets.

@gbili
Last active December 16, 2015 21:39
Show Gist options
  • Save gbili/5501490 to your computer and use it in GitHub Desktop.
Save gbili/5501490 to your computer and use it in GitHub Desktop.
<?php
public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
$values = array_map(function($val) {
return "'".$val."'";
}, $this->values);
return "ENUM(".implode(", ", $values).") COMMENT '(DC2Type:".$this->name.")'";
}
// BECOMES...
public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
$values = array_map(function($val) {
return "'$val'";
}, $this->values);
return 'ENUM(' . implode(', ', $values) . ") COMMENT '(DC2Type:{$this->name})'";
}
// OR JUST SHORTER...
public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
return "ENUM('" . implode("', '", $this->values) . "') COMMENT '(DC2Type:{$this->name})'";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment