Add days of week to flights table; add to import/export for flights

This commit is contained in:
Nabeel Shahzad
2018-03-22 21:21:35 -05:00
parent 8b53ca2fdc
commit 7105e82922
17 changed files with 310 additions and 21 deletions

View File

@@ -67,12 +67,7 @@ abstract class Enum
*/
public static function getFromCode($code)
{
$code = strtoupper($code);
if(!array_key_exists($code, static::$codes)) {
return null;
}
return static::$codes[$code];
return array_search($code, static::$codes, true);
}
/**
@@ -82,7 +77,12 @@ abstract class Enum
*/
public static function convertToCode($value)
{
return array_search($value, static::$codes, true);
$value = (int) $value;
if (!array_key_exists($value, static::$codes)) {
return null;
}
return static::$codes[$value];
}
/**