| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /* | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * This software consists of voluntary contributions made by many individuals | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * and is licensed under the MIT license. For more information, see | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * <http://www.doctrine-project.org>. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | namespace Doctrine\ODM\MongoDB\Mapping; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | use Doctrine\Common\Persistence\Mapping\MappingException as BaseMappingException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  * Class for all exceptions related to the Doctrine MongoDB ODM | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  * @since       1.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | class MappingException extends BaseMappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      * @param string $name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |     public static function typeExists($name) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |         return new self('Type ' . $name . ' already exists.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |      * @param string $name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     public static function typeNotFound($name) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         return new self('Type to be overwritten ' . $name . ' does not exist.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |      * @param string $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 | 6 |  |     public static function mappingNotFound($className, $fieldName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 | 6 |  |         return new self("No mapping found for field '$fieldName' in class '$className'."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |      * @param string $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |     public static function referenceMappingNotFound($className, $fieldName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |         return new self("No reference mapping found for field '$fieldName' in class '$className'."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |      * @param string $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 | 2 |  |     public static function mappingNotFoundInClassNorDescendants($className, $fieldName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 | 2 |  |         return new self("No mapping found for field '$fieldName' in class '$className' nor its descendants."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |      * @param $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |      * @param $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |      * @param $className2 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 | 2 |  |     public static function referenceFieldConflict($fieldName, $className, $className2) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 | 2 |  |         return new self("Reference mapping for field '$fieldName' in class '$className' conflicts with one mapped in class '$className2'."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |      * @param string $dbFieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |     public static function mappingNotFoundByDbName($className, $dbFieldName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |         return new self("No mapping found for field by DB name '$dbFieldName' in class '$className'."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |      * @param string $document | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |      * @param string $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |     public static function duplicateFieldMapping($document, $fieldName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |         return new self('Property "' . $fieldName . '" in "' . $document . '" was already declared, but it must be declared only once'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |      * @param string $document | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |      * @param string $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 | 2 |  |     public static function discriminatorFieldConflict($document, $fieldName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 | 2 |  |         return new self('Discriminator field "' . $fieldName . '" in "' . $document . '" conflicts with a mapped field\'s "name" attribute.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |      * Throws an exception that indicates that a class used in a discriminator map does not exist. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |      * An example would be an outdated (maybe renamed) classname. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |      * @param string $className The class that could not be found | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |      * @param string $owningClass The class that declares the discriminator map. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |     public static function invalidClassInDiscriminatorMap($className, $owningClass) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |         return new self( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |             "Document class '$className' used in the discriminator map of class '$owningClass' " . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |             'does not exist.' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |      * Throws an exception that indicates a discriminator value does not exist in a map | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |      * @param string $value The discriminator value that could not be found | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |      * @param string $owningClass The class that declares the discriminator map | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |     public static function invalidDiscriminatorValue($value, $owningClass) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |         return new self("Discriminator value '$value' used in the declaration of class '$owningClass' does not exist."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |     public static function missingFieldName($className) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |         return new self("The Document class '$className' field mapping misses the 'fieldName' attribute."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 | 3 |  |     public static function classIsNotAValidDocument($className) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 | 3 |  |         return new self('Class ' . $className . ' is not a valid document or mapped super class.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |      * Exception for reflection exceptions - adds the document name, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |      * because there might be long classnames that will be shortened | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |      * within the stacktrace | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |      * @param string $document The document's name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |      * @param \ReflectionException $previousException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |      * @return \Doctrine\ODM\MongoDB\Mapping\MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |     public static function reflectionFailure($document, \ReflectionException $previousException) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |         return new self('An error occurred in ' . $document, 0, $previousException); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |      * @param string $documentName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |     public static function identifierRequired($documentName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |         return new self("No identifier/primary key specified for Document '$documentName'." | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |             . ' Every Document must have an identifier/primary key.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |      * @param string $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |     public static function missingIdentifierField($className, $fieldName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |         return new self("The identifier $fieldName is missing for a query of " . $className); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |     public static function missingIdGeneratorClass($className) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |         return new self("The class-option for the custom ID generator is missing in class $className."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |     public static function classIsNotAValidGenerator($className) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |         return new self("The class $className if not a valid ID generator of type AbstractIdGenerator."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |      * @param string $optionName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |     public static function missingGeneratorSetter($className, $optionName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |         return new self("The class $className is missing a setter for the option $optionName."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |      * @param string $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 | 1 |  |     public static function cascadeOnEmbeddedNotAllowed($className, $fieldName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 | 1 |  |         return new self("Cascade on $className::$fieldName is not allowed."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |      * @param string $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 | 3 |  |     public static function simpleReferenceRequiresTargetDocument($className, $fieldName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 | 3 |  |         return new self("Target document must be specified for simple reference: $className::$fieldName"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |      * @param string $targetDocument | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 | 1 |  |     public static function simpleReferenceMustNotTargetDiscriminatedDocument($targetDocument) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 | 1 |  |         return new self("Simple reference must not target document using Single Collection Inheritance, $targetDocument targeted."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |      * @param string $strategy | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |      * @param string $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 | 1 |  |     public static function atomicCollectionStrategyNotAllowed($strategy, $className, $fieldName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 | 1 |  |         return new self("$strategy collection strategy can be used only in top level document, used in $className::$fieldName"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |      * @param string $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |      * @return MappingException | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 272 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 273 | 4 |  |     public static function owningAndInverseReferencesRequireTargetDocument($className, $fieldName) | 
            
                                                                        
                            
            
                                    
            
            
                | 274 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 275 | 4 |  |         return new self("Target document must be specified for owning/inverse sides of reference: $className::$fieldName"); | 
            
                                                                        
                            
            
                                    
            
            
                | 276 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |      * @param string $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 | 1 |  |     public static function mustNotChangeIdentifierFieldsType($className, $fieldName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 | 1 |  |         return new self("$className::$fieldName was declared an identifier and must stay this way."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |      * @param string $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |      * @param string $strategy | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 | 1 |  |     public static function referenceManySortMustNotBeUsedWithNonSetCollectionStrategy($className, $fieldName, $strategy) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 | 1 |  |         return new self("ReferenceMany's sort can not be used with addToSet and pushAll strategies, $strategy used in $className::$fieldName"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |      * @param string $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |      * @param string $type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |      * @param string $strategy | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |     public static function invalidStorageStrategy($className, $fieldName, $type, $strategy) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |         return new self("Invalid strategy $strategy used in $className::$fieldName with type $type"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |      * @param string $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |      * @param string $collectionClass | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 | 1 |  |     public static function collectionClassDoesNotImplementCommonInterface($className, $fieldName, $collectionClass) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 | 1 |  |         return new self("$collectionClass used as custom collection class for $className::$fieldName has to implement Doctrine\\Common\\Collections\\Collection interface."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |      * @param $subclassName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 | 2 |  |     public static function shardKeyInSingleCollInheritanceSubclass($subclassName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 | 2 |  |         return new self("Shard key overriding in subclass is forbidden for single collection inheritance: $subclassName"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |      * @param $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 | 2 |  |     public static function embeddedDocumentCantHaveShardKey($className) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 | 2 |  |         return new self("Embedded document can't have shard key: $className"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |      * @param string $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 | 1 |  |     public static function onlySetStrategyAllowedInShardKey($className, $fieldName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 | 1 |  |         return new self("Only fields using the SET strategy can be used in the shard key: $className::$fieldName"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |      * @param $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |      * @param $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 | 3 |  |     public static function noMultiKeyShardKeys($className, $fieldName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 | 3 |  |         return new self("No multikey indexes are allowed in the shard key: $className::$fieldName"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |      * @param string $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |     public static function cannotLookupDbRefReference($className, $fieldName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  |         return new self("Cannot use reference '$fieldName' in class '$className' for lookup or graphLookup: dbRef references are not supported."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  |      * @param string $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |     public static function repositoryMethodLookupNotAllowed($className, $fieldName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |         return new self("Cannot use reference '$fieldName' in class '$className' for lookup or graphLookup. repositoryMethod is not supported in \$lookup and \$graphLookup stages."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 | 1 |  |     public static function cannotUseShardedCollectionInOutStage($className) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 | 1 |  |         return new self("Cannot use class '$className' as collection for out stage. Sharded collections are not allowed."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 | 3 |  |     public static function cannotUseShardedCollectionInLookupStages($className) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 | 3 |  |         return new self("Cannot use class '$className' as collection for lookup or graphLookup stage. Sharded collections are not allowed."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |      * @param string $className | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  |      * @param string $fieldName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |      * @return MappingException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |     public static function referencePrimersOnlySupportedForInverseReferenceMany($className, $fieldName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |         return new self("Cannot use reference priming on '$fieldName' in class '$className'. Reference priming is only supported for inverse references"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 | 1 |  |     public static function connectFromFieldMustReferenceSameDocument($fieldName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 | 1 |  |         return new self("Cannot use field '$fieldName' as connectFromField in \$graphLookup stage. Reference must target the document itself."); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 413 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 414 |  |  |  |