| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Doctrine\Persistence\Mapping; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Exception; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use function class_exists; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use function implode; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use function sprintf; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * A MappingException indicates that something is wrong with the mapping setup. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | class MappingException extends Exception | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |      * @param string   $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |      * @param string[] $namespaces | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |      * @return self | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 | 1 |  |     public static function classNotFoundInNamespaces($className, $namespaces) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 | 1 |  |         return new self(sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 | 1 |  |             "The class '%s' was not found in the chain configured namespaces %s", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 | 1 |  |             $className, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 | 1 |  |             implode(', ', $namespaces) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |         )); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |      * @return self | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 32 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 33 |  |  |     public static function pathRequired() | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |         return new self('Specifying the paths to your entities is required ' . | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |             'in the AnnotationDriver to retrieve all class names.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |      * @param string|null $path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |      * @return self | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     public static function fileMappingDriversRequireConfiguredDirectoryPath($path = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         if (! empty($path)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |             $path = '[' . $path . ']'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |         return new self(sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |             'File mapping drivers must have a valid directory path, ' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |             'however the given path %s seems to be incorrect!', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |             $path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         )); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |      * @param string $entityName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |      * @param string $fileName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |      * @return self | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 | 2 |  |     public static function mappingFileNotFound($entityName, $fileName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 | 2 |  |         return new self(sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 | 2 |  |             "No mapping file found named '%s' for class '%s'.", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 | 2 |  |             $fileName, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 | 2 |  |             $entityName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |         )); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |      * @param string $entityName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |      * @param string $fileName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |      * @return self | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |     public static function invalidMappingFile($entityName, $fileName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |         return new self(sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |             "Invalid mapping file '%s' for class '%s'.", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |             $fileName, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |             $entityName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |         )); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |      * @return self | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 | 1 |  |     public static function nonExistingClass($className) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 | 1 |  |         return new self(sprintf("Class '%s' does not exist", $className)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 98 |  |  | class_exists(\Doctrine\Common\Persistence\Mapping\MappingException::class); | 
            
                                                        
            
                                    
            
            
                | 99 |  |  |  |