Skip to content

Commit 7ddd3d9

Browse files
authored
Merge pull request #149 from fre5h/feature-standard-types
Feature standard types
2 parents 5c2a3ef + e4530b2 commit 7ddd3d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+265
-35
lines changed

DBAL/Types/AbstractEnumType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* This file is part of the FreshDoctrineEnumBundle
3+
* This file is part of the FreshDoctrineEnumBundle.
44
*
55
* (c) Artem Henvald <genvaldartem@gmail.com>
66
*

DBAL/Types/DayOfWeekFullNameType.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
/*
3+
* This file is part of the FreshDoctrineEnumBundle.
4+
*
5+
* (c) Artem Henvald <genvaldartem@gmail.com>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
declare(strict_types=1);
12+
13+
namespace Fresh\DoctrineEnumBundle\DBAL\Types;
14+
15+
/**
16+
* DayOfWeekFullNameType.
17+
*
18+
* @author Artem Henvald <genvaldartem@gmail.com>
19+
*/
20+
final class DayOfWeekFullNameType extends AbstractEnumType
21+
{
22+
public const MONDAY = 'monday';
23+
24+
public const TUESDAY = 'tuesday';
25+
26+
public const WEDNESDAY = 'wednesday';
27+
28+
public const THURSDAY = 'thursday';
29+
30+
public const FRIDAY = 'friday';
31+
32+
public const SATURDAY = 'saturday';
33+
34+
public const SUNDAY = 'sunday';
35+
36+
/**
37+
* {@inheritdoc}
38+
*/
39+
protected static $choices = [
40+
self::MONDAY => 'Monday',
41+
self::TUESDAY => 'Tuesday',
42+
self::WEDNESDAY => 'Wednesday',
43+
self::THURSDAY => 'Thursday',
44+
self::FRIDAY => 'Friday',
45+
self::SATURDAY => 'Saturday',
46+
self::SUNDAY => 'Sunday',
47+
];
48+
}

DBAL/Types/DayOfWeekShortNameType.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
/*
3+
* This file is part of the FreshDoctrineEnumBundle.
4+
*
5+
* (c) Artem Henvald <genvaldartem@gmail.com>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
declare(strict_types=1);
12+
13+
namespace Fresh\DoctrineEnumBundle\DBAL\Types;
14+
15+
/**
16+
* DayOfWeekShortNameType.
17+
*
18+
* @author Artem Henvald <genvaldartem@gmail.com>
19+
*/
20+
final class DayOfWeekShortNameType extends AbstractEnumType
21+
{
22+
public const MONDAY = 'mon';
23+
24+
public const TUESDAY = 'tue';
25+
26+
public const WEDNESDAY = 'wed';
27+
28+
public const THURSDAY = 'thu';
29+
30+
public const FRIDAY = 'fri';
31+
32+
public const SATURDAY = 'sat';
33+
34+
public const SUNDAY = 'sun';
35+
36+
/**
37+
* {@inheritdoc}
38+
*/
39+
protected static $choices = [
40+
self::MONDAY => 'Monday',
41+
self::TUESDAY => 'Tuesday',
42+
self::WEDNESDAY => 'Wednesday',
43+
self::THURSDAY => 'Thursday',
44+
self::FRIDAY => 'Friday',
45+
self::SATURDAY => 'Saturday',
46+
self::SUNDAY => 'Sunday',
47+
];
48+
}

DBAL/Types/MonthFullNameType.php

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
/*
3+
* This file is part of the FreshDoctrineEnumBundle.
4+
*
5+
* (c) Artem Henvald <genvaldartem@gmail.com>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
declare(strict_types=1);
12+
13+
namespace Fresh\DoctrineEnumBundle\DBAL\Types;
14+
15+
/**
16+
* MonthFullNameType.
17+
*
18+
* @author Artem Henvald <genvaldartem@gmail.com>
19+
*/
20+
final class MonthFullNameType extends AbstractEnumType
21+
{
22+
public const JANUARY = 'january';
23+
24+
public const FEBRUARY = 'february';
25+
26+
public const MARCH = 'march';
27+
28+
public const APRIL = 'april';
29+
30+
public const MAY = 'may';
31+
32+
public const JUNE = 'june';
33+
34+
public const JULY = 'july';
35+
36+
public const AUGUST = 'august';
37+
38+
public const SEPTEMBER = 'september';
39+
40+
public const OCTOBER = 'october';
41+
42+
public const NOVEMBER = 'november';
43+
44+
public const DECEMBER = 'december';
45+
46+
/**
47+
* {@inheritdoc}
48+
*/
49+
protected static $choices = [
50+
self::JANUARY => 'January',
51+
self::FEBRUARY => 'February',
52+
self::MARCH => 'March',
53+
self::APRIL => 'April',
54+
self::MAY => 'May',
55+
self::JUNE => 'June',
56+
self::JULY => 'July',
57+
self::AUGUST => 'August',
58+
self::SEPTEMBER => 'September',
59+
self::OCTOBER => 'October',
60+
self::NOVEMBER => 'November',
61+
self::DECEMBER => 'December',
62+
];
63+
}

DBAL/Types/MonthShortNameType.php

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
/*
3+
* This file is part of the FreshDoctrineEnumBundle.
4+
*
5+
* (c) Artem Henvald <genvaldartem@gmail.com>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
declare(strict_types=1);
12+
13+
namespace Fresh\DoctrineEnumBundle\DBAL\Types;
14+
15+
/**
16+
* MonthShortNameType.
17+
*
18+
* @author Artem Henvald <genvaldartem@gmail.com>
19+
*/
20+
final class MonthShortNameType extends AbstractEnumType
21+
{
22+
public const JANUARY = 'jan';
23+
24+
public const FEBRUARY = 'feb';
25+
26+
public const MARCH = 'mar';
27+
28+
public const APRIL = 'apr';
29+
30+
public const MAY = 'may';
31+
32+
public const JUNE = 'jun';
33+
34+
public const JULY = 'jul';
35+
36+
public const AUGUST = 'aug';
37+
38+
public const SEPTEMBER = 'sep';
39+
40+
public const OCTOBER = 'oct';
41+
42+
public const NOVEMBER = 'nov';
43+
44+
public const DECEMBER = 'dec';
45+
46+
/**
47+
* {@inheritdoc}
48+
*/
49+
protected static $choices = [
50+
self::JANUARY => 'January',
51+
self::FEBRUARY => 'February',
52+
self::MARCH => 'March',
53+
self::APRIL => 'April',
54+
self::MAY => 'May',
55+
self::JUNE => 'June',
56+
self::JULY => 'July',
57+
self::AUGUST => 'August',
58+
self::SEPTEMBER => 'September',
59+
self::OCTOBER => 'October',
60+
self::NOVEMBER => 'November',
61+
self::DECEMBER => 'December',
62+
];
63+
}

DependencyInjection/FreshDoctrineEnumExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* This file is part of the FreshDoctrineEnumBundle
3+
* This file is part of the FreshDoctrineEnumBundle.
44
*
55
* (c) Artem Henvald <genvaldartem@gmail.com>
66
*

Exception/Constant/ConstantIsFoundInFewRegisteredEnumTypesException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* This file is part of the FreshDoctrineEnumBundle
3+
* This file is part of the FreshDoctrineEnumBundle.
44
*
55
* (c) Artem Henvald <genvaldartem@gmail.com>
66
*

Exception/Constant/ConstantIsNotFoundInAnyRegisteredEnumTypeException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* This file is part of the FreshDoctrineEnumBundle
3+
* This file is part of the FreshDoctrineEnumBundle.
44
*
55
* (c) Artem Henvald <genvaldartem@gmail.com>
66
*

Exception/EnumType/EnumTypeIsNotRegisteredException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* This file is part of the FreshDoctrineEnumBundle
3+
* This file is part of the FreshDoctrineEnumBundle.
44
*
55
* (c) Artem Henvald <genvaldartem@gmail.com>
66
*

Exception/EnumType/EnumTypeIsRegisteredButClassDoesNotExistException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* This file is part of the FreshDoctrineEnumBundle
3+
* This file is part of the FreshDoctrineEnumBundle.
44
*
55
* (c) Artem Henvald <genvaldartem@gmail.com>
66
*

Exception/EnumType/NoRegisteredEnumTypesException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* This file is part of the FreshDoctrineEnumBundle
3+
* This file is part of the FreshDoctrineEnumBundle.
44
*
55
* (c) Artem Henvald <genvaldartem@gmail.com>
66
*

Exception/EnumValue/ValueIsFoundInFewRegisteredEnumTypesException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* This file is part of the FreshDoctrineEnumBundle
3+
* This file is part of the FreshDoctrineEnumBundle.
44
*
55
* (c) Artem Henvald <genvaldartem@gmail.com>
66
*

Exception/EnumValue/ValueIsNotFoundInAnyRegisteredEnumTypeException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* This file is part of the FreshDoctrineEnumBundle
3+
* This file is part of the FreshDoctrineEnumBundle.
44
*
55
* (c) Artem Henvald <genvaldartem@gmail.com>
66
*

Form/EnumTypeGuesser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* This file is part of the FreshDoctrineEnumBundle
3+
* This file is part of the FreshDoctrineEnumBundle.
44
*
55
* (c) Artem Henvald <genvaldartem@gmail.com>
66
*

FreshDoctrineEnumBundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* This file is part of the FreshDoctrineEnumBundle
3+
* This file is part of the FreshDoctrineEnumBundle.
44
*
55
* (c) Artem Henvald <genvaldartem@gmail.com>
66
*

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ return [
5454
* [NULL values](./Resources/docs/null_values.md "NULL values")
5555
* [Building the form](./Resources/docs/building_the_form.md "Building the form")
5656
* [Additional methods](./Resources/docs/additional_methods.md "Additional methods")
57+
* [Common types](./Resources/docs/common_types.md "Common types")
5758
* [Readable ENUM values in templates](./Resources/docs/readable_enum_values_in_template.md "Readable ENUM values in templates")
5859
* [ENUM constants in templates](./Resources/docs/enum_constants_in_templates.md "ENUM constants in templates")
5960
* [ENUM values in templates](./Resources/docs/enum_values_in_templates.md "ENUM values in templates")

Resources/docs/common_types.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Common types
2+
3+
[DayOfWeekFullNameType](./../../DBAL/Types/DayOfWeekFullNameType.php "DayOfWeekFullNameType"): monday, tuesday, wednesday, etc.
4+
[DayOfWeekShortNameType](./../../DBAL/Types/DayOfWeekShortNameType.php "DayOfWeekShortNameType"): mon, tue, wed, etc.
5+
[MonthFullNameType](./../../DBAL/Types/MonthFullNameType.php "MonthFullNameType"): january, february, march, etc.
6+
[MonthShortNameType](./../../DBAL/Types/MonthShortNameType.php "MonthShortNameType"): jan, feb, mar, etc.
7+

Tests/DBAL/Types/AbstractEnumTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* This file is part of the FreshDoctrineEnumBundle
3+
* This file is part of the FreshDoctrineEnumBundle.
44
*
55
* (c) Artem Henvald <genvaldartem@gmail.com>
66
*

Tests/DependencyInjection/FreshDoctrineEnumExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* This file is part of the FreshDoctrineEnumBundle
3+
* This file is part of the FreshDoctrineEnumBundle.
44
*
55
* (c) Artem Henvald <genvaldartem@gmail.com>
66
*

Tests/Fixtures/DBAL/Types/AbstractParentType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* This file is part of the FreshDoctrineEnumBundle
3+
* This file is part of the FreshDoctrineEnumBundle.
44
*
55
* (c) Artem Henvald <genvaldartem@gmail.com>
66
*

Tests/Fixtures/DBAL/Types/BasketballPositionType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* This file is part of the FreshDoctrineEnumBundle
3+
* This file is part of the FreshDoctrineEnumBundle.
44
*
55
* (c) Artem Henvald <genvaldartem@gmail.com>
66
*

Tests/Fixtures/DBAL/Types/InheritedType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* This file is part of the FreshDoctrineEnumBundle
3+
* This file is part of the FreshDoctrineEnumBundle.
44
*
55
* (c) Artem Henvald <genvaldartem@gmail.com>
66
*

Tests/Fixtures/DBAL/Types/MapLocationType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* This file is part of the FreshDoctrineEnumBundle
3+
* This file is part of the FreshDoctrineEnumBundle.
44
*
55
* (c) Artem Henvald <genvaldartem@gmail.com>
66
*

Tests/Fixtures/DBAL/Types/NotAChildType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* This file is part of the FreshDoctrineEnumBundle
3+
* This file is part of the FreshDoctrineEnumBundle.
44
*
55
* (c) Artem Henvald <genvaldartem@gmail.com>
66
*

Tests/Fixtures/DBAL/Types/NumericType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* This file is part of the FreshDoctrineEnumBundle
3+
* This file is part of the FreshDoctrineEnumBundle.
44
*
55
* (c) Artem Henvald <genvaldartem@gmail.com>
66
*

0 commit comments

Comments
 (0)