1 | <?php |
||
20 | class DrestException extends Exception |
||
21 | { |
||
22 | |||
23 | // Set up and configuration |
||
24 | 1 | public static function metadataCacheNotConfigured() |
|
25 | { |
||
26 | 1 | return new self( |
|
27 | 'Class Metadata Cache is not configured, ensure an instance of Doctrine\Common\Cache\Cache' . |
||
28 | 1 | 'is passed to the Drest\Configuration::setMetadataCacheImpl()'); |
|
29 | } |
||
30 | |||
31 | 1 | public static function currentlyRunningDebugMode() |
|
32 | { |
||
33 | 1 | return new self( |
|
34 | 'Debug mode is set to on. This will cause configuration exceptions to be' . |
||
35 | 1 | ' displayed and should be switched off in production'); |
|
36 | } |
||
37 | |||
38 | 1 | public static function annotatedResourceRequiresAtLeastOneServiceDefinition($className) |
|
39 | { |
||
40 | 1 | return new self( |
|
41 | 1 | 'The annotated resource on class ' . $className . ' doesn\'t have any service definitions.' . |
|
42 | 1 | ' Ensure you have "services={@Drest\Service(..)} set'); |
|
43 | } |
||
44 | |||
45 | 2 | public static function routeAlreadyDefinedWithName($class, $name) |
|
46 | { |
||
47 | 2 | return new self( |
|
48 | 2 | 'Route on class ' . $class . ' already exists with the name ' . $name . '. These must be unique'); |
|
49 | } |
||
50 | |||
51 | 2 | public static function routeNameIsEmpty() |
|
52 | { |
||
53 | 2 | return new self( |
|
54 | 2 | 'Route name used cannot be blank, and must only contain alphanumerics or underscore'); |
|
55 | } |
||
56 | |||
57 | /** |
||
58 | * @param string $verb |
||
59 | * @return DrestException |
||
60 | */ |
||
61 | 2 | public static function invalidHttpVerbUsed($verb) |
|
62 | { |
||
63 | 2 | return new self( |
|
64 | 2 | 'Used an unknown HTTP verb of "' . $verb . '"'); |
|
65 | } |
||
66 | |||
67 | 1 | public static function unknownDetectContentOption() |
|
68 | { |
||
69 | 1 | return new self( |
|
70 | 1 | 'Content option used is invalid. Please see DETECT_CONTENT_* options in Drest\Configuration'); |
|
71 | } |
||
72 | |||
73 | 1 | public static function pathToConfigFilesRequired() |
|
74 | { |
||
75 | 1 | return new self( |
|
76 | 1 | 'Path to your configuration files are required for the driver to retrieve all class names'); |
|
77 | } |
||
78 | |||
79 | 2 | public static function unableToLoadMetaDataFromDriver() |
|
80 | { |
||
81 | 2 | return new self( |
|
82 | 2 | 'Unable to load metadata using supplied driver'); |
|
83 | } |
||
84 | |||
85 | 1 | public static function invalidExposeRelationFetchType() |
|
86 | { |
||
87 | 1 | return new self( |
|
88 | 'Invalid relation fetch type used. ' . |
||
89 | 1 | 'Please see Doctrine\ORM\Mapping\ClassMetadataInfo::FETCH_* for available options'); |
|
90 | } |
||
91 | |||
92 | 1 | public static function unknownExposeRequestOption() |
|
93 | { |
||
94 | 1 | return new self( |
|
95 | 'Unknown expose request option used. ' . |
||
96 | 1 | 'Please see EXPOSE_REQUEST_* options in Drest\Configuration'); |
|
97 | } |
||
98 | |||
99 | 1 | public static function basePathMustBeAString() |
|
103 | |||
104 | public static function handleAlreadyDefinedForRoute(Mapping\RouteMetaData $route) |
||
105 | { |
||
106 | return new self( |
||
107 | 'There is a handle already defined for the route ' |
||
108 | . $route->getName() . ' on class ' . $route->getClassMetaData()->getClassName()); |
||
109 | } |
||
110 | |||
111 | 1 | public static function handleForGetRouteMustBeStatic() |
|
112 | { |
||
113 | 1 | return new self('Any handle used for a get call must be defined as static'); |
|
114 | } |
||
115 | |||
116 | /** |
||
117 | * @param string $name |
||
118 | * @return DrestException |
||
119 | */ |
||
120 | 1 | public static function handleAnnotationDoesntMatchRouteName($name) |
|
126 | |||
127 | /** |
||
128 | * @param string $name |
||
129 | * @return DrestException |
||
130 | */ |
||
131 | public static function routeRequiresHandle($name) |
||
137 | |||
138 | public static function handleForCannotBeEmpty() |
||
142 | |||
143 | public static function invalidNamedRouteSyntax() |
||
149 | |||
150 | |||
151 | /** |
||
152 | * @param string $routeName |
||
153 | * @param string $className |
||
154 | * @return DrestException |
||
155 | */ |
||
156 | 1 | public static function unableToFindRouteByName($routeName, $className) |
|
161 | |||
162 | public static function resourceCanOnlyHaveOneRouteSetAsOrigin() |
||
166 | |||
167 | public static function unableToHandleACollectionPush() |
||
173 | |||
174 | /** |
||
175 | * Service Exceptions |
||
176 | * @param string $class |
||
177 | * @return DrestException |
||
178 | */ |
||
179 | public static function actionClassNotAnInstanceOfActionAbstract($class) |
||
184 | |||
185 | /** |
||
186 | * @param string $class |
||
187 | * @return DrestException |
||
188 | */ |
||
189 | public static function unknownActionClass($class) |
||
193 | |||
194 | public static function noMatchedRouteSet() |
||
200 | } |
||
201 |