Complex classes like ClassMetadataInfo often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use ClassMetadataInfo, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 51 | class ClassMetadataInfo implements ClassMetadata |
||
| 52 | { |
||
| 53 | /* The inheritance mapping types */ |
||
| 54 | /** |
||
| 55 | * NONE means the class does not participate in an inheritance hierarchy |
||
| 56 | * and therefore does not need an inheritance mapping type. |
||
| 57 | */ |
||
| 58 | const INHERITANCE_TYPE_NONE = 1; |
||
| 59 | |||
| 60 | /** |
||
| 61 | * JOINED means the class will be persisted according to the rules of |
||
| 62 | * <tt>Class Table Inheritance</tt>. |
||
| 63 | */ |
||
| 64 | const INHERITANCE_TYPE_JOINED = 2; |
||
| 65 | |||
| 66 | /** |
||
| 67 | * SINGLE_TABLE means the class will be persisted according to the rules of |
||
| 68 | * <tt>Single Table Inheritance</tt>. |
||
| 69 | */ |
||
| 70 | const INHERITANCE_TYPE_SINGLE_TABLE = 3; |
||
| 71 | |||
| 72 | /** |
||
| 73 | * TABLE_PER_CLASS means the class will be persisted according to the rules |
||
| 74 | * of <tt>Concrete Table Inheritance</tt>. |
||
| 75 | */ |
||
| 76 | const INHERITANCE_TYPE_TABLE_PER_CLASS = 4; |
||
| 77 | |||
| 78 | /* The Id generator types. */ |
||
| 79 | /** |
||
| 80 | * AUTO means the generator type will depend on what the used platform prefers. |
||
| 81 | * Offers full portability. |
||
| 82 | */ |
||
| 83 | const GENERATOR_TYPE_AUTO = 1; |
||
| 84 | |||
| 85 | /** |
||
| 86 | * SEQUENCE means a separate sequence object will be used. Platforms that do |
||
| 87 | * not have native sequence support may emulate it. Full portability is currently |
||
| 88 | * not guaranteed. |
||
| 89 | */ |
||
| 90 | const GENERATOR_TYPE_SEQUENCE = 2; |
||
| 91 | |||
| 92 | /** |
||
| 93 | * TABLE means a separate table is used for id generation. |
||
| 94 | * Offers full portability. |
||
| 95 | */ |
||
| 96 | const GENERATOR_TYPE_TABLE = 3; |
||
| 97 | |||
| 98 | /** |
||
| 99 | * IDENTITY means an identity column is used for id generation. The database |
||
| 100 | * will fill in the id column on insertion. Platforms that do not support |
||
| 101 | * native identity columns may emulate them. Full portability is currently |
||
| 102 | * not guaranteed. |
||
| 103 | */ |
||
| 104 | const GENERATOR_TYPE_IDENTITY = 4; |
||
| 105 | |||
| 106 | /** |
||
| 107 | * NONE means the class does not have a generated id. That means the class |
||
| 108 | * must have a natural, manually assigned id. |
||
| 109 | */ |
||
| 110 | const GENERATOR_TYPE_NONE = 5; |
||
| 111 | |||
| 112 | /** |
||
| 113 | * UUID means that a UUID/GUID expression is used for id generation. Full |
||
| 114 | * portability is currently not guaranteed. |
||
| 115 | */ |
||
| 116 | const GENERATOR_TYPE_UUID = 6; |
||
| 117 | |||
| 118 | /** |
||
| 119 | * CUSTOM means that customer will use own ID generator that supposedly work |
||
| 120 | */ |
||
| 121 | const GENERATOR_TYPE_CUSTOM = 7; |
||
| 122 | |||
| 123 | /** |
||
| 124 | * DEFERRED_IMPLICIT means that changes of entities are calculated at commit-time |
||
| 125 | * by doing a property-by-property comparison with the original data. This will |
||
| 126 | * be done for all entities that are in MANAGED state at commit-time. |
||
| 127 | * |
||
| 128 | * This is the default change tracking policy. |
||
| 129 | */ |
||
| 130 | const CHANGETRACKING_DEFERRED_IMPLICIT = 1; |
||
| 131 | |||
| 132 | /** |
||
| 133 | * DEFERRED_EXPLICIT means that changes of entities are calculated at commit-time |
||
| 134 | * by doing a property-by-property comparison with the original data. This will |
||
| 135 | * be done only for entities that were explicitly saved (through persist() or a cascade). |
||
| 136 | */ |
||
| 137 | const CHANGETRACKING_DEFERRED_EXPLICIT = 2; |
||
| 138 | |||
| 139 | /** |
||
| 140 | * NOTIFY means that Doctrine relies on the entities sending out notifications |
||
| 141 | * when their properties change. Such entity classes must implement |
||
| 142 | * the <tt>NotifyPropertyChanged</tt> interface. |
||
| 143 | */ |
||
| 144 | const CHANGETRACKING_NOTIFY = 3; |
||
| 145 | |||
| 146 | /** |
||
| 147 | * Specifies that an association is to be fetched when it is first accessed. |
||
| 148 | */ |
||
| 149 | const FETCH_LAZY = 2; |
||
| 150 | |||
| 151 | /** |
||
| 152 | * Specifies that an association is to be fetched when the owner of the |
||
| 153 | * association is fetched. |
||
| 154 | */ |
||
| 155 | const FETCH_EAGER = 3; |
||
| 156 | |||
| 157 | /** |
||
| 158 | * Specifies that an association is to be fetched lazy (on first access) and that |
||
| 159 | * commands such as Collection#count, Collection#slice are issued directly against |
||
| 160 | * the database if the collection is not yet initialized. |
||
| 161 | */ |
||
| 162 | const FETCH_EXTRA_LAZY = 4; |
||
| 163 | |||
| 164 | /** |
||
| 165 | * Identifies a one-to-one association. |
||
| 166 | */ |
||
| 167 | const ONE_TO_ONE = 1; |
||
| 168 | |||
| 169 | /** |
||
| 170 | * Identifies a many-to-one association. |
||
| 171 | */ |
||
| 172 | const MANY_TO_ONE = 2; |
||
| 173 | |||
| 174 | /** |
||
| 175 | * Identifies a one-to-many association. |
||
| 176 | */ |
||
| 177 | const ONE_TO_MANY = 4; |
||
| 178 | |||
| 179 | /** |
||
| 180 | * Identifies a many-to-many association. |
||
| 181 | */ |
||
| 182 | const MANY_TO_MANY = 8; |
||
| 183 | |||
| 184 | /** |
||
| 185 | * Combined bitmask for to-one (single-valued) associations. |
||
| 186 | */ |
||
| 187 | const TO_ONE = 3; |
||
| 188 | |||
| 189 | /** |
||
| 190 | * Combined bitmask for to-many (collection-valued) associations. |
||
| 191 | */ |
||
| 192 | const TO_MANY = 12; |
||
| 193 | |||
| 194 | /** |
||
| 195 | * ReadOnly cache can do reads, inserts and deletes, cannot perform updates or employ any locks, |
||
| 196 | */ |
||
| 197 | const CACHE_USAGE_READ_ONLY = 1; |
||
| 198 | |||
| 199 | /** |
||
| 200 | * Nonstrict Read Write Cache doesn’t employ any locks but can do inserts, update and deletes. |
||
| 201 | */ |
||
| 202 | const CACHE_USAGE_NONSTRICT_READ_WRITE = 2; |
||
| 203 | |||
| 204 | /** |
||
| 205 | * Read Write Attempts to lock the entity before update/delete. |
||
| 206 | */ |
||
| 207 | const CACHE_USAGE_READ_WRITE = 3; |
||
| 208 | |||
| 209 | /** |
||
| 210 | * READ-ONLY: The name of the entity class. |
||
| 211 | * |
||
| 212 | * @var string |
||
| 213 | */ |
||
| 214 | public $name; |
||
| 215 | |||
| 216 | /** |
||
| 217 | * READ-ONLY: The namespace the entity class is contained in. |
||
| 218 | * |
||
| 219 | * @var string |
||
| 220 | * |
||
| 221 | * @todo Not really needed. Usage could be localized. |
||
| 222 | */ |
||
| 223 | public $namespace; |
||
| 224 | |||
| 225 | /** |
||
| 226 | * READ-ONLY: The name of the entity class that is at the root of the mapped entity inheritance |
||
| 227 | * hierarchy. If the entity is not part of a mapped inheritance hierarchy this is the same |
||
| 228 | * as {@link $name}. |
||
| 229 | * |
||
| 230 | * @var string |
||
| 231 | */ |
||
| 232 | public $rootEntityName; |
||
| 233 | |||
| 234 | /** |
||
| 235 | * READ-ONLY: The definition of custom generator. Only used for CUSTOM |
||
| 236 | * generator type |
||
| 237 | * |
||
| 238 | * The definition has the following structure: |
||
| 239 | * <code> |
||
| 240 | * array( |
||
| 241 | * 'class' => 'ClassName', |
||
| 242 | * ) |
||
| 243 | * </code> |
||
| 244 | * |
||
| 245 | * @var array |
||
| 246 | * |
||
| 247 | * @todo Merge with tableGeneratorDefinition into generic generatorDefinition |
||
| 248 | */ |
||
| 249 | public $customGeneratorDefinition; |
||
| 250 | |||
| 251 | /** |
||
| 252 | * The name of the custom repository class used for the entity class. |
||
| 253 | * (Optional). |
||
| 254 | * |
||
| 255 | * @var string |
||
| 256 | */ |
||
| 257 | public $customRepositoryClassName; |
||
| 258 | |||
| 259 | /** |
||
| 260 | * The name of the custom collection class used for the entity class. |
||
| 261 | * (Optional). |
||
| 262 | * |
||
| 263 | * @var string |
||
| 264 | */ |
||
| 265 | public $customCollectionClassName; |
||
| 266 | |||
| 267 | /** |
||
| 268 | * READ-ONLY: Whether this class describes the mapping of a mapped superclass. |
||
| 269 | * |
||
| 270 | * @var boolean |
||
| 271 | */ |
||
| 272 | public $isMappedSuperclass = false; |
||
| 273 | |||
| 274 | /** |
||
| 275 | * READ-ONLY: Whether this class describes the mapping of an embeddable class. |
||
| 276 | * |
||
| 277 | * @var boolean |
||
| 278 | */ |
||
| 279 | public $isEmbeddedClass = false; |
||
| 280 | |||
| 281 | /** |
||
| 282 | * READ-ONLY: The names of the parent classes (ancestors). |
||
| 283 | * |
||
| 284 | * @var array |
||
| 285 | */ |
||
| 286 | public $parentClasses = array(); |
||
| 287 | |||
| 288 | /** |
||
| 289 | * READ-ONLY: The names of all subclasses (descendants). |
||
| 290 | * |
||
| 291 | * @var array |
||
| 292 | */ |
||
| 293 | public $subClasses = array(); |
||
| 294 | |||
| 295 | /** |
||
| 296 | * READ-ONLY: The names of all embedded classes based on properties. |
||
| 297 | * |
||
| 298 | * @var array |
||
| 299 | */ |
||
| 300 | public $embeddedClasses = array(); |
||
| 301 | |||
| 302 | /** |
||
| 303 | * READ-ONLY: The named queries allowed to be called directly from Repository. |
||
| 304 | * |
||
| 305 | * @var array |
||
| 306 | */ |
||
| 307 | public $namedQueries = array(); |
||
| 308 | |||
| 309 | /** |
||
| 310 | * READ-ONLY: The named native queries allowed to be called directly from Repository. |
||
| 311 | * |
||
| 312 | * A native SQL named query definition has the following structure: |
||
| 313 | * <pre> |
||
| 314 | * array( |
||
| 315 | * 'name' => <query name>, |
||
| 316 | * 'query' => <sql query>, |
||
| 317 | * 'resultClass' => <class of the result>, |
||
| 318 | * 'resultSetMapping' => <name of a SqlResultSetMapping> |
||
| 319 | * ) |
||
| 320 | * </pre> |
||
| 321 | * |
||
| 322 | * @var array |
||
| 323 | */ |
||
| 324 | public $namedNativeQueries = array(); |
||
| 325 | |||
| 326 | /** |
||
| 327 | * READ-ONLY: The mappings of the results of native SQL queries. |
||
| 328 | * |
||
| 329 | * A native result mapping definition has the following structure: |
||
| 330 | * <pre> |
||
| 331 | * array( |
||
| 332 | * 'name' => <result name>, |
||
| 333 | * 'entities' => array(<entity result mapping>), |
||
| 334 | * 'columns' => array(<column result mapping>) |
||
| 335 | * ) |
||
| 336 | * </pre> |
||
| 337 | * |
||
| 338 | * @var array |
||
| 339 | */ |
||
| 340 | public $sqlResultSetMappings = array(); |
||
| 341 | |||
| 342 | /** |
||
| 343 | * READ-ONLY: The field names of all fields that are part of the identifier/primary key |
||
| 344 | * of the mapped entity class. |
||
| 345 | * |
||
| 346 | * @var array |
||
| 347 | */ |
||
| 348 | public $identifier = array(); |
||
| 349 | |||
| 350 | /** |
||
| 351 | * READ-ONLY: The inheritance mapping type used by the class. |
||
| 352 | * |
||
| 353 | * @var integer |
||
| 354 | */ |
||
| 355 | public $inheritanceType = self::INHERITANCE_TYPE_NONE; |
||
| 356 | |||
| 357 | /** |
||
| 358 | * READ-ONLY: The Id generator type used by the class. |
||
| 359 | * |
||
| 360 | * @var int |
||
| 361 | */ |
||
| 362 | public $generatorType = self::GENERATOR_TYPE_NONE; |
||
| 363 | |||
| 364 | /** |
||
| 365 | * READ-ONLY: The field mappings of the class. |
||
| 366 | * Keys are field names and values are mapping definitions. |
||
| 367 | * |
||
| 368 | * The mapping definition array has the following values: |
||
| 369 | * |
||
| 370 | * - <b>fieldName</b> (string) |
||
| 371 | * The name of the field in the Entity. |
||
| 372 | * |
||
| 373 | * - <b>type</b> (string) |
||
| 374 | * The type name of the mapped field. Can be one of Doctrine's mapping types |
||
| 375 | * or a custom mapping type. |
||
| 376 | * |
||
| 377 | * - <b>columnName</b> (string, optional) |
||
| 378 | * The column name. Optional. Defaults to the field name. |
||
| 379 | * |
||
| 380 | * - <b>length</b> (integer, optional) |
||
| 381 | * The database length of the column. Optional. Default value taken from |
||
| 382 | * the type. |
||
| 383 | * |
||
| 384 | * - <b>id</b> (boolean, optional) |
||
| 385 | * Marks the field as the primary key of the entity. Multiple fields of an |
||
| 386 | * entity can have the id attribute, forming a composite key. |
||
| 387 | * |
||
| 388 | * - <b>nullable</b> (boolean, optional) |
||
| 389 | * Whether the column is nullable. Defaults to FALSE. |
||
| 390 | * |
||
| 391 | * - <b>columnDefinition</b> (string, optional, schema-only) |
||
| 392 | * The SQL fragment that is used when generating the DDL for the column. |
||
| 393 | * |
||
| 394 | * - <b>precision</b> (integer, optional, schema-only) |
||
| 395 | * The precision of a decimal column. Only valid if the column type is decimal. |
||
| 396 | * |
||
| 397 | * - <b>scale</b> (integer, optional, schema-only) |
||
| 398 | * The scale of a decimal column. Only valid if the column type is decimal. |
||
| 399 | * |
||
| 400 | * - <b>'unique'</b> (string, optional, schema-only) |
||
| 401 | * Whether a unique constraint should be generated for the column. |
||
| 402 | * |
||
| 403 | * @var array |
||
| 404 | */ |
||
| 405 | public $fieldMappings = array(); |
||
| 406 | |||
| 407 | /** |
||
| 408 | * READ-ONLY: An array of field names. Used to look up field names from column names. |
||
| 409 | * Keys are column names and values are field names. |
||
| 410 | * |
||
| 411 | * @var array |
||
| 412 | */ |
||
| 413 | public $fieldNames = array(); |
||
| 414 | |||
| 415 | /** |
||
| 416 | * READ-ONLY: A map of field names to column names. Keys are field names and values column names. |
||
| 417 | * Used to look up column names from field names. |
||
| 418 | * This is the reverse lookup map of $_fieldNames. |
||
| 419 | * |
||
| 420 | * @var array |
||
| 421 | * |
||
| 422 | * @deprecated 3.0 Remove this. |
||
| 423 | */ |
||
| 424 | public $columnNames = array(); |
||
| 425 | |||
| 426 | /** |
||
| 427 | * READ-ONLY: The discriminator value of this class. |
||
| 428 | * |
||
| 429 | * <b>This does only apply to the JOINED and SINGLE_TABLE inheritance mapping strategies |
||
| 430 | * where a discriminator column is used.</b> |
||
| 431 | * |
||
| 432 | * @var mixed |
||
| 433 | * |
||
| 434 | * @see discriminatorColumn |
||
| 435 | */ |
||
| 436 | public $discriminatorValue; |
||
| 437 | |||
| 438 | /** |
||
| 439 | * READ-ONLY: The discriminator map of all mapped classes in the hierarchy. |
||
| 440 | * |
||
| 441 | * <b>This does only apply to the JOINED and SINGLE_TABLE inheritance mapping strategies |
||
| 442 | * where a discriminator column is used.</b> |
||
| 443 | * |
||
| 444 | * @var mixed |
||
| 445 | * |
||
| 446 | * @see discriminatorColumn |
||
| 447 | */ |
||
| 448 | public $discriminatorMap = array(); |
||
| 449 | |||
| 450 | /** |
||
| 451 | * READ-ONLY: The definition of the discriminator column used in JOINED and SINGLE_TABLE |
||
| 452 | * inheritance mappings. |
||
| 453 | * |
||
| 454 | * @var array |
||
| 455 | */ |
||
| 456 | public $discriminatorColumn; |
||
| 457 | |||
| 458 | /** |
||
| 459 | * READ-ONLY: The primary table definition. The definition is an array with the |
||
| 460 | * following entries: |
||
| 461 | * |
||
| 462 | * name => <tableName> |
||
| 463 | * schema => <schemaName> |
||
| 464 | * indexes => array |
||
| 465 | * uniqueConstraints => array |
||
| 466 | * |
||
| 467 | * @var array |
||
| 468 | */ |
||
| 469 | public $table; |
||
| 470 | |||
| 471 | /** |
||
| 472 | * READ-ONLY: The registered lifecycle callbacks for entities of this class. |
||
| 473 | * |
||
| 474 | * @var array |
||
| 475 | */ |
||
| 476 | public $lifecycleCallbacks = array(); |
||
| 477 | |||
| 478 | /** |
||
| 479 | * READ-ONLY: The registered entity listeners. |
||
| 480 | * |
||
| 481 | * @var array |
||
| 482 | */ |
||
| 483 | public $entityListeners = array(); |
||
| 484 | |||
| 485 | /** |
||
| 486 | * READ-ONLY: The association mappings of this class. |
||
| 487 | * |
||
| 488 | * The mapping definition array supports the following keys: |
||
| 489 | * |
||
| 490 | * - <b>fieldName</b> (string) |
||
| 491 | * The name of the field in the entity the association is mapped to. |
||
| 492 | * |
||
| 493 | * - <b>targetEntity</b> (string) |
||
| 494 | * The class name of the target entity. If it is fully-qualified it is used as is. |
||
| 495 | * If it is a simple, unqualified class name the namespace is assumed to be the same |
||
| 496 | * as the namespace of the source entity. |
||
| 497 | * |
||
| 498 | * - <b>mappedBy</b> (string, required for bidirectional associations) |
||
| 499 | * The name of the field that completes the bidirectional association on the owning side. |
||
| 500 | * This key must be specified on the inverse side of a bidirectional association. |
||
| 501 | * |
||
| 502 | * - <b>inversedBy</b> (string, required for bidirectional associations) |
||
| 503 | * The name of the field that completes the bidirectional association on the inverse side. |
||
| 504 | * This key must be specified on the owning side of a bidirectional association. |
||
| 505 | * |
||
| 506 | * - <b>cascade</b> (array, optional) |
||
| 507 | * The names of persistence operations to cascade on the association. The set of possible |
||
| 508 | * values are: "persist", "remove", "detach", "merge", "refresh", "all" (implies all others). |
||
| 509 | * |
||
| 510 | * - <b>orderBy</b> (array, one-to-many/many-to-many only) |
||
| 511 | * A map of field names (of the target entity) to sorting directions (ASC/DESC). |
||
| 512 | * Example: array('priority' => 'desc') |
||
| 513 | * |
||
| 514 | * - <b>fetch</b> (integer, optional) |
||
| 515 | * The fetching strategy to use for the association, usually defaults to FETCH_LAZY. |
||
| 516 | * Possible values are: ClassMetadata::FETCH_EAGER, ClassMetadata::FETCH_LAZY. |
||
| 517 | * |
||
| 518 | * - <b>joinTable</b> (array, optional, many-to-many only) |
||
| 519 | * Specification of the join table and its join columns (foreign keys). |
||
| 520 | * Only valid for many-to-many mappings. Note that one-to-many associations can be mapped |
||
| 521 | * through a join table by simply mapping the association as many-to-many with a unique |
||
| 522 | * constraint on the join table. |
||
| 523 | * |
||
| 524 | * - <b>indexBy</b> (string, optional, to-many only) |
||
| 525 | * Specification of a field on target-entity that is used to index the collection by. |
||
| 526 | * This field HAS to be either the primary key or a unique column. Otherwise the collection |
||
| 527 | * does not contain all the entities that are actually related. |
||
| 528 | * |
||
| 529 | * A join table definition has the following structure: |
||
| 530 | * <pre> |
||
| 531 | * array( |
||
| 532 | * 'name' => <join table name>, |
||
| 533 | * 'joinColumns' => array(<join column mapping from join table to source table>), |
||
| 534 | * 'inverseJoinColumns' => array(<join column mapping from join table to target table>) |
||
| 535 | * ) |
||
| 536 | * </pre> |
||
| 537 | * |
||
| 538 | * @var array |
||
| 539 | */ |
||
| 540 | public $associationMappings = array(); |
||
| 541 | |||
| 542 | /** |
||
| 543 | * READ-ONLY: Flag indicating whether the identifier/primary key of the class is composite. |
||
| 544 | * |
||
| 545 | * @var boolean |
||
| 546 | */ |
||
| 547 | public $isIdentifierComposite = false; |
||
| 548 | |||
| 549 | /** |
||
| 550 | * READ-ONLY: Flag indicating whether the identifier/primary key contains at least one foreign key association. |
||
| 551 | * |
||
| 552 | * This flag is necessary because some code blocks require special treatment of this cases. |
||
| 553 | * |
||
| 554 | * @var boolean |
||
| 555 | */ |
||
| 556 | public $containsForeignIdentifier = false; |
||
| 557 | |||
| 558 | /** |
||
| 559 | * READ-ONLY: The ID generator used for generating IDs for this class. |
||
| 560 | * |
||
| 561 | * @var \Doctrine\ORM\Id\AbstractIdGenerator |
||
| 562 | * |
||
| 563 | * @todo Remove! |
||
| 564 | */ |
||
| 565 | public $idGenerator; |
||
| 566 | |||
| 567 | /** |
||
| 568 | * READ-ONLY: The definition of the sequence generator of this class. Only used for the |
||
| 569 | * SEQUENCE generation strategy. |
||
| 570 | * |
||
| 571 | * The definition has the following structure: |
||
| 572 | * <code> |
||
| 573 | * array( |
||
| 574 | * 'sequenceName' => 'name', |
||
| 575 | * 'allocationSize' => 20, |
||
| 576 | * 'initialValue' => 1 |
||
| 577 | * ) |
||
| 578 | * </code> |
||
| 579 | * |
||
| 580 | * @var array |
||
| 581 | * |
||
| 582 | * @todo Merge with tableGeneratorDefinition into generic generatorDefinition |
||
| 583 | */ |
||
| 584 | public $sequenceGeneratorDefinition; |
||
| 585 | |||
| 586 | /** |
||
| 587 | * READ-ONLY: The definition of the table generator of this class. Only used for the |
||
| 588 | * TABLE generation strategy. |
||
| 589 | * |
||
| 590 | * @var array |
||
| 591 | * |
||
| 592 | * @todo Merge with tableGeneratorDefinition into generic generatorDefinition |
||
| 593 | */ |
||
| 594 | public $tableGeneratorDefinition; |
||
| 595 | |||
| 596 | /** |
||
| 597 | * READ-ONLY: The policy used for change-tracking on entities of this class. |
||
| 598 | * |
||
| 599 | * @var integer |
||
| 600 | */ |
||
| 601 | public $changeTrackingPolicy = self::CHANGETRACKING_DEFERRED_IMPLICIT; |
||
| 602 | |||
| 603 | /** |
||
| 604 | * READ-ONLY: A flag for whether or not instances of this class are to be versioned |
||
| 605 | * with optimistic locking. |
||
| 606 | * |
||
| 607 | * @var boolean |
||
| 608 | */ |
||
| 609 | public $isVersioned; |
||
| 610 | |||
| 611 | /** |
||
| 612 | * READ-ONLY: The name of the field which is used for versioning in optimistic locking (if any). |
||
| 613 | * |
||
| 614 | * @var mixed |
||
| 615 | */ |
||
| 616 | public $versionField; |
||
| 617 | |||
| 618 | /** |
||
| 619 | * @var array |
||
| 620 | */ |
||
| 621 | public $cache = null; |
||
| 622 | |||
| 623 | /** |
||
| 624 | * The ReflectionClass instance of the mapped class. |
||
| 625 | * |
||
| 626 | * @var ReflectionClass |
||
| 627 | */ |
||
| 628 | public $reflClass; |
||
| 629 | |||
| 630 | /** |
||
| 631 | * Is this entity marked as "read-only"? |
||
| 632 | * |
||
| 633 | * That means it is never considered for change-tracking in the UnitOfWork. It is a very helpful performance |
||
| 634 | * optimization for entities that are immutable, either in your domain or through the relation database |
||
| 635 | * (coming from a view, or a history table for example). |
||
| 636 | * |
||
| 637 | * @var bool |
||
| 638 | */ |
||
| 639 | public $isReadOnly = false; |
||
| 640 | |||
| 641 | /** |
||
| 642 | * NamingStrategy determining the default column and table names. |
||
| 643 | * |
||
| 644 | * @var \Doctrine\ORM\Mapping\NamingStrategy |
||
| 645 | */ |
||
| 646 | protected $namingStrategy; |
||
| 647 | |||
| 648 | /** |
||
| 649 | * The ReflectionProperty instances of the mapped class. |
||
| 650 | * |
||
| 651 | * @var \ReflectionProperty[] |
||
| 652 | */ |
||
| 653 | public $reflFields = array(); |
||
| 654 | |||
| 655 | /** |
||
| 656 | * @var \Doctrine\Instantiator\InstantiatorInterface|null |
||
| 657 | */ |
||
| 658 | private $instantiator; |
||
| 659 | |||
| 660 | /** |
||
| 661 | * Initializes a new ClassMetadata instance that will hold the object-relational mapping |
||
| 662 | * metadata of the class with the given name. |
||
| 663 | * |
||
| 664 | * @param string $entityName The name of the entity class the new instance is used for. |
||
| 665 | * @param NamingStrategy|null $namingStrategy |
||
| 666 | */ |
||
| 667 | 648 | public function __construct($entityName, NamingStrategy $namingStrategy = null) |
|
| 668 | { |
||
| 669 | 648 | $this->name = $entityName; |
|
| 670 | 648 | $this->rootEntityName = $entityName; |
|
| 671 | 648 | $this->namingStrategy = $namingStrategy ?: new DefaultNamingStrategy(); |
|
| 672 | 648 | $this->instantiator = new Instantiator(); |
|
| 673 | 648 | } |
|
| 674 | |||
| 675 | /** |
||
| 676 | * Gets the ReflectionProperties of the mapped class. |
||
| 677 | * |
||
| 678 | * @return array An array of ReflectionProperty instances. |
||
| 679 | */ |
||
| 680 | 223 | public function getReflectionProperties() |
|
| 684 | |||
| 685 | /** |
||
| 686 | * Gets a ReflectionProperty for a specific field of the mapped class. |
||
| 687 | * |
||
| 688 | * @param string $name |
||
| 689 | * |
||
| 690 | * @return \ReflectionProperty |
||
| 691 | */ |
||
| 692 | 1 | public function getReflectionProperty($name) |
|
| 696 | |||
| 697 | /** |
||
| 698 | * Gets the ReflectionProperty for the single identifier field. |
||
| 699 | * |
||
| 700 | * @return \ReflectionProperty |
||
| 701 | * |
||
| 702 | * @throws BadMethodCallException If the class has a composite identifier. |
||
| 703 | */ |
||
| 704 | public function getSingleIdReflectionProperty() |
||
| 705 | { |
||
| 706 | if ($this->isIdentifierComposite) { |
||
| 707 | throw new BadMethodCallException("Class " . $this->name . " has a composite identifier."); |
||
| 708 | } |
||
| 709 | |||
| 710 | return $this->reflFields[$this->identifier[0]]; |
||
| 711 | } |
||
| 712 | |||
| 713 | /** |
||
| 714 | * Extracts the identifier values of an entity of this class. |
||
| 715 | * |
||
| 716 | * For composite identifiers, the identifier values are returned as an array |
||
| 717 | * with the same order as the field order in {@link identifier}. |
||
| 718 | * |
||
| 719 | * @param object $entity |
||
| 720 | * |
||
| 721 | * @return array |
||
| 722 | */ |
||
| 723 | 463 | public function getIdentifierValues($entity) |
|
| 724 | { |
||
| 725 | 463 | if ($this->isIdentifierComposite) { |
|
| 726 | 90 | $id = array(); |
|
| 727 | |||
| 728 | 90 | foreach ($this->identifier as $idField) { |
|
| 729 | 90 | $value = $this->reflFields[$idField]->getValue($entity); |
|
| 730 | |||
| 731 | 90 | if ($value !== null) { |
|
| 732 | 90 | $id[$idField] = $value; |
|
| 733 | } |
||
| 734 | } |
||
| 735 | |||
| 736 | 90 | return $id; |
|
| 737 | } |
||
| 738 | |||
| 739 | 444 | $id = $this->identifier[0]; |
|
| 740 | 444 | $value = $this->reflFields[$id]->getValue($entity); |
|
| 741 | |||
| 742 | 444 | if (null === $value) { |
|
| 743 | 28 | return array(); |
|
| 744 | } |
||
| 745 | |||
| 746 | 421 | return array($id => $value); |
|
| 747 | } |
||
| 748 | |||
| 749 | /** |
||
| 750 | * Populates the entity identifier of an entity. |
||
| 751 | * |
||
| 752 | * @param object $entity |
||
| 753 | * @param array $id |
||
| 754 | * |
||
| 755 | * @return void |
||
| 756 | * |
||
| 757 | * @todo Rename to assignIdentifier() |
||
| 758 | */ |
||
| 759 | 6 | public function setIdentifierValues($entity, array $id) |
|
| 760 | { |
||
| 761 | 6 | foreach ($id as $idField => $idValue) { |
|
| 762 | 6 | $this->reflFields[$idField]->setValue($entity, $idValue); |
|
| 763 | } |
||
| 764 | 6 | } |
|
| 765 | |||
| 766 | /** |
||
| 767 | * Sets the specified field to the specified value on the given entity. |
||
| 768 | * |
||
| 769 | * @param object $entity |
||
| 770 | * @param string $field |
||
| 771 | * @param mixed $value |
||
| 772 | * |
||
| 773 | * @return void |
||
| 774 | */ |
||
| 775 | 231 | public function setFieldValue($entity, $field, $value) |
|
| 779 | |||
| 780 | /** |
||
| 781 | * Gets the specified field's value off the given entity. |
||
| 782 | * |
||
| 783 | * @param object $entity |
||
| 784 | * @param string $field |
||
| 785 | * |
||
| 786 | * @return mixed |
||
| 787 | */ |
||
| 788 | 302 | public function getFieldValue($entity, $field) |
|
| 792 | |||
| 793 | /** |
||
| 794 | * Creates a string representation of this instance. |
||
| 795 | * |
||
| 796 | * @return string The string representation of this instance. |
||
| 797 | * |
||
| 798 | * @todo Construct meaningful string representation. |
||
| 799 | */ |
||
| 800 | public function __toString() |
||
| 804 | |||
| 805 | /** |
||
| 806 | * Determines which fields get serialized. |
||
| 807 | * |
||
| 808 | * It is only serialized what is necessary for best unserialization performance. |
||
| 809 | * That means any metadata properties that are not set or empty or simply have |
||
| 810 | * their default value are NOT serialized. |
||
| 811 | * |
||
| 812 | * Parts that are also NOT serialized because they can not be properly unserialized: |
||
| 813 | * - reflClass (ReflectionClass) |
||
| 814 | * - reflFields (ReflectionProperty array) |
||
| 815 | * |
||
| 816 | * @return array The names of all the fields that should be serialized. |
||
| 817 | */ |
||
| 818 | 6 | public function __sleep() |
|
| 912 | |||
| 913 | /** |
||
| 914 | * Creates a new instance of the mapped class, without invoking the constructor. |
||
| 915 | * |
||
| 916 | * @return object |
||
| 917 | */ |
||
| 918 | 672 | public function newInstance() |
|
| 922 | |||
| 923 | /** |
||
| 924 | * Restores some state that can not be serialized/unserialized. |
||
| 925 | * |
||
| 926 | * @param \Doctrine\Common\Persistence\Mapping\ReflectionService $reflService |
||
| 927 | * |
||
| 928 | * @return void |
||
| 929 | */ |
||
| 930 | 2012 | public function wakeupReflection($reflService) |
|
| 977 | |||
| 978 | /** |
||
| 979 | * Initializes a new ClassMetadata instance that will hold the object-relational mapping |
||
| 980 | * metadata of the class with the given name. |
||
| 981 | * |
||
| 982 | * @param \Doctrine\Common\Persistence\Mapping\ReflectionService $reflService The reflection service. |
||
| 983 | * |
||
| 984 | * @return void |
||
| 985 | */ |
||
| 986 | 612 | public function initializeReflection($reflService) |
|
| 997 | |||
| 998 | /** |
||
| 999 | * Validates Identifier. |
||
| 1000 | * |
||
| 1001 | * @return void |
||
| 1002 | * |
||
| 1003 | * @throws MappingException |
||
| 1004 | */ |
||
| 1005 | 401 | public function validateIdentifier() |
|
| 1020 | |||
| 1021 | /** |
||
| 1022 | * Validates association targets actually exist. |
||
| 1023 | * |
||
| 1024 | * @return void |
||
| 1025 | * |
||
| 1026 | * @throws MappingException |
||
| 1027 | */ |
||
| 1028 | 402 | public function validateAssociations() |
|
| 1036 | |||
| 1037 | /** |
||
| 1038 | * Validates lifecycle callbacks. |
||
| 1039 | * |
||
| 1040 | * @param \Doctrine\Common\Persistence\Mapping\ReflectionService $reflService |
||
| 1041 | * |
||
| 1042 | * @return void |
||
| 1043 | * |
||
| 1044 | * @throws MappingException |
||
| 1045 | */ |
||
| 1046 | 402 | public function validateLifecycleCallbacks($reflService) |
|
| 1056 | |||
| 1057 | /** |
||
| 1058 | * {@inheritDoc} |
||
| 1059 | */ |
||
| 1060 | 529 | public function getReflectionClass() |
|
| 1064 | |||
| 1065 | /** |
||
| 1066 | * @param array $cache |
||
| 1067 | * |
||
| 1068 | * @return void |
||
| 1069 | */ |
||
| 1070 | 21 | public function enableCache(array $cache) |
|
| 1082 | |||
| 1083 | /** |
||
| 1084 | * @param string $fieldName |
||
| 1085 | * @param array $cache |
||
| 1086 | * |
||
| 1087 | * @return void |
||
| 1088 | */ |
||
| 1089 | 2 | public function enableAssociationCache($fieldName, array $cache) |
|
| 1093 | |||
| 1094 | /** |
||
| 1095 | * @param string $fieldName |
||
| 1096 | * @param array $cache |
||
| 1097 | * |
||
| 1098 | * @return array |
||
| 1099 | */ |
||
| 1100 | 17 | public function getAssociationCacheDefaults($fieldName, array $cache) |
|
| 1114 | |||
| 1115 | /** |
||
| 1116 | * Sets the change tracking policy used by this class. |
||
| 1117 | * |
||
| 1118 | * @param integer $policy |
||
| 1119 | * |
||
| 1120 | * @return void |
||
| 1121 | */ |
||
| 1122 | 138 | public function setChangeTrackingPolicy($policy) |
|
| 1126 | |||
| 1127 | /** |
||
| 1128 | * Whether the change tracking policy of this class is "deferred explicit". |
||
| 1129 | * |
||
| 1130 | * @return boolean |
||
| 1131 | */ |
||
| 1132 | 267 | public function isChangeTrackingDeferredExplicit() |
|
| 1136 | |||
| 1137 | /** |
||
| 1138 | * Whether the change tracking policy of this class is "deferred implicit". |
||
| 1139 | * |
||
| 1140 | * @return boolean |
||
| 1141 | */ |
||
| 1142 | 457 | public function isChangeTrackingDeferredImplicit() |
|
| 1146 | |||
| 1147 | /** |
||
| 1148 | * Whether the change tracking policy of this class is "notify". |
||
| 1149 | * |
||
| 1150 | * @return boolean |
||
| 1151 | */ |
||
| 1152 | 289 | public function isChangeTrackingNotify() |
|
| 1156 | |||
| 1157 | /** |
||
| 1158 | * Checks whether a field is part of the identifier/primary key field(s). |
||
| 1159 | * |
||
| 1160 | * @param string $fieldName The field name. |
||
| 1161 | * |
||
| 1162 | * @return boolean TRUE if the field is part of the table identifier/primary key field(s), |
||
| 1163 | * FALSE otherwise. |
||
| 1164 | */ |
||
| 1165 | 1068 | public function isIdentifier($fieldName) |
|
| 1177 | |||
| 1178 | /** |
||
| 1179 | * Checks if the field is unique. |
||
| 1180 | * |
||
| 1181 | * @param string $fieldName The field name. |
||
| 1182 | * |
||
| 1183 | * @return boolean TRUE if the field is unique, FALSE otherwise. |
||
| 1184 | */ |
||
| 1185 | public function isUniqueField($fieldName) |
||
| 1195 | |||
| 1196 | /** |
||
| 1197 | * Checks if the field is not null. |
||
| 1198 | * |
||
| 1199 | * @param string $fieldName The field name. |
||
| 1200 | * |
||
| 1201 | * @return boolean TRUE if the field is not null, FALSE otherwise. |
||
| 1202 | */ |
||
| 1203 | 1 | public function isNullable($fieldName) |
|
| 1213 | |||
| 1214 | /** |
||
| 1215 | * Gets a column name for a field name. |
||
| 1216 | * If the column name for the field cannot be found, the given field name |
||
| 1217 | * is returned. |
||
| 1218 | * |
||
| 1219 | * @param string $fieldName The field name. |
||
| 1220 | * |
||
| 1221 | * @return string The column name. |
||
| 1222 | */ |
||
| 1223 | 16 | public function getColumnName($fieldName) |
|
| 1229 | |||
| 1230 | /** |
||
| 1231 | * Gets the mapping of a (regular) field that holds some data but not a |
||
| 1232 | * reference to another object. |
||
| 1233 | * |
||
| 1234 | * @param string $fieldName The field name. |
||
| 1235 | * |
||
| 1236 | * @return array The field mapping. |
||
| 1237 | * |
||
| 1238 | * @throws MappingException |
||
| 1239 | */ |
||
| 1240 | 199 | public function getFieldMapping($fieldName) |
|
| 1248 | |||
| 1249 | /** |
||
| 1250 | * Gets the mapping of an association. |
||
| 1251 | * |
||
| 1252 | * @see ClassMetadataInfo::$associationMappings |
||
| 1253 | * |
||
| 1254 | * @param string $fieldName The field name that represents the association in |
||
| 1255 | * the object model. |
||
| 1256 | * |
||
| 1257 | * @return array The mapping. |
||
| 1258 | * |
||
| 1259 | * @throws MappingException |
||
| 1260 | */ |
||
| 1261 | 484 | public function getAssociationMapping($fieldName) |
|
| 1269 | |||
| 1270 | /** |
||
| 1271 | * Gets all association mappings of the class. |
||
| 1272 | * |
||
| 1273 | * @return array |
||
| 1274 | */ |
||
| 1275 | public function getAssociationMappings() |
||
| 1279 | |||
| 1280 | /** |
||
| 1281 | * Gets the field name for a column name. |
||
| 1282 | * If no field name can be found the column name is returned. |
||
| 1283 | * |
||
| 1284 | * @param string $columnName The column name. |
||
| 1285 | * |
||
| 1286 | * @return string The column alias. |
||
| 1287 | */ |
||
| 1288 | 236 | public function getFieldName($columnName) |
|
| 1294 | |||
| 1295 | /** |
||
| 1296 | * Gets the named query. |
||
| 1297 | * |
||
| 1298 | * @see ClassMetadataInfo::$namedQueries |
||
| 1299 | * |
||
| 1300 | * @param string $queryName The query name. |
||
| 1301 | * |
||
| 1302 | * @return string |
||
| 1303 | * |
||
| 1304 | * @throws MappingException |
||
| 1305 | */ |
||
| 1306 | 4 | public function getNamedQuery($queryName) |
|
| 1314 | |||
| 1315 | /** |
||
| 1316 | * Gets all named queries of the class. |
||
| 1317 | * |
||
| 1318 | * @return array |
||
| 1319 | */ |
||
| 1320 | 7 | public function getNamedQueries() |
|
| 1324 | |||
| 1325 | /** |
||
| 1326 | * Gets the named native query. |
||
| 1327 | * |
||
| 1328 | * @see ClassMetadataInfo::$namedNativeQueries |
||
| 1329 | * |
||
| 1330 | * @param string $queryName The query name. |
||
| 1331 | * |
||
| 1332 | * @return array |
||
| 1333 | * |
||
| 1334 | * @throws MappingException |
||
| 1335 | */ |
||
| 1336 | 17 | public function getNamedNativeQuery($queryName) |
|
| 1344 | |||
| 1345 | /** |
||
| 1346 | * Gets all named native queries of the class. |
||
| 1347 | * |
||
| 1348 | * @return array |
||
| 1349 | */ |
||
| 1350 | 2 | public function getNamedNativeQueries() |
|
| 1354 | |||
| 1355 | /** |
||
| 1356 | * Gets the result set mapping. |
||
| 1357 | * |
||
| 1358 | * @see ClassMetadataInfo::$sqlResultSetMappings |
||
| 1359 | * |
||
| 1360 | * @param string $name The result set mapping name. |
||
| 1361 | * |
||
| 1362 | * @return array |
||
| 1363 | * |
||
| 1364 | * @throws MappingException |
||
| 1365 | */ |
||
| 1366 | 21 | public function getSqlResultSetMapping($name) |
|
| 1374 | |||
| 1375 | /** |
||
| 1376 | * Gets all sql result set mappings of the class. |
||
| 1377 | * |
||
| 1378 | * @return array |
||
| 1379 | */ |
||
| 1380 | 8 | public function getSqlResultSetMappings() |
|
| 1384 | |||
| 1385 | /** |
||
| 1386 | * Validates & completes the given field mapping. |
||
| 1387 | * |
||
| 1388 | * @param array $mapping The field mapping to validate & complete. |
||
| 1389 | * |
||
| 1390 | * @return array The validated and completed field mapping. |
||
| 1391 | * |
||
| 1392 | * @throws MappingException |
||
| 1393 | */ |
||
| 1394 | 529 | protected function _validateAndCompleteFieldMapping(array &$mapping) |
|
| 1448 | |||
| 1449 | /** |
||
| 1450 | * Validates & completes the basic mapping information that is common to all |
||
| 1451 | * association mappings (one-to-one, many-ot-one, one-to-many, many-to-many). |
||
| 1452 | * |
||
| 1453 | * @param array $mapping The mapping. |
||
| 1454 | * |
||
| 1455 | * @return array The updated mapping. |
||
| 1456 | * |
||
| 1457 | * @throws MappingException If something is wrong with the mapping. |
||
| 1458 | */ |
||
| 1459 | 352 | protected function _validateAndCompleteAssociationMapping(array $mapping) |
|
| 1571 | |||
| 1572 | /** |
||
| 1573 | * Validates & completes a one-to-one association mapping. |
||
| 1574 | * |
||
| 1575 | * @param array $mapping The mapping to validate & complete. |
||
| 1576 | * |
||
| 1577 | * @return array The validated & completed mapping. |
||
| 1578 | * |
||
| 1579 | * @throws RuntimeException |
||
| 1580 | * @throws MappingException |
||
| 1581 | */ |
||
| 1582 | 299 | protected function _validateAndCompleteOneToOneMapping(array $mapping) |
|
| 1664 | |||
| 1665 | /** |
||
| 1666 | * Validates & completes a one-to-many association mapping. |
||
| 1667 | * |
||
| 1668 | * @param array $mapping The mapping to validate and complete. |
||
| 1669 | * |
||
| 1670 | * @return array The validated and completed mapping. |
||
| 1671 | * |
||
| 1672 | * @throws MappingException |
||
| 1673 | * @throws InvalidArgumentException |
||
| 1674 | */ |
||
| 1675 | 129 | protected function _validateAndCompleteOneToManyMapping(array $mapping) |
|
| 1695 | |||
| 1696 | /** |
||
| 1697 | * Validates & completes a many-to-many association mapping. |
||
| 1698 | * |
||
| 1699 | * @param array $mapping The mapping to validate & complete. |
||
| 1700 | * |
||
| 1701 | * @return array The validated & completed mapping. |
||
| 1702 | * |
||
| 1703 | * @throws \InvalidArgumentException |
||
| 1704 | */ |
||
| 1705 | 150 | protected function _validateAndCompleteManyToManyMapping(array $mapping) |
|
| 1805 | |||
| 1806 | /** |
||
| 1807 | * {@inheritDoc} |
||
| 1808 | */ |
||
| 1809 | 593 | public function getIdentifierFieldNames() |
|
| 1813 | |||
| 1814 | /** |
||
| 1815 | * Gets the name of the single id field. Note that this only works on |
||
| 1816 | * entity classes that have a single-field pk. |
||
| 1817 | * |
||
| 1818 | * @return string |
||
| 1819 | * |
||
| 1820 | * @throws MappingException If the class has a composite primary key. |
||
| 1821 | */ |
||
| 1822 | 398 | public function getSingleIdentifierFieldName() |
|
| 1830 | |||
| 1831 | /** |
||
| 1832 | * Gets the column name of the single id column. Note that this only works on |
||
| 1833 | * entity classes that have a single-field pk. |
||
| 1834 | * |
||
| 1835 | * @return string |
||
| 1836 | * |
||
| 1837 | * @throws MappingException If the class has a composite primary key. |
||
| 1838 | */ |
||
| 1839 | 3 | public function getSingleIdentifierColumnName() |
|
| 1843 | |||
| 1844 | /** |
||
| 1845 | * INTERNAL: |
||
| 1846 | * Sets the mapped identifier/primary key fields of this class. |
||
| 1847 | * Mainly used by the ClassMetadataFactory to assign inherited identifiers. |
||
| 1848 | * |
||
| 1849 | * @param array $identifier |
||
| 1850 | * |
||
| 1851 | * @return void |
||
| 1852 | */ |
||
| 1853 | 123 | public function setIdentifier(array $identifier) |
|
| 1858 | |||
| 1859 | /** |
||
| 1860 | * {@inheritDoc} |
||
| 1861 | */ |
||
| 1862 | 61 | public function getIdentifier() |
|
| 1866 | |||
| 1867 | /** |
||
| 1868 | * {@inheritDoc} |
||
| 1869 | */ |
||
| 1870 | 292 | public function hasField($fieldName) |
|
| 1874 | |||
| 1875 | /** |
||
| 1876 | * Gets an array containing all the column names. |
||
| 1877 | * |
||
| 1878 | * @param array|null $fieldNames |
||
| 1879 | * |
||
| 1880 | * @return array |
||
| 1881 | */ |
||
| 1882 | 42 | public function getColumnNames(array $fieldNames = null) |
|
| 1890 | |||
| 1891 | /** |
||
| 1892 | * Returns an array with all the identifier column names. |
||
| 1893 | * |
||
| 1894 | * @return array |
||
| 1895 | */ |
||
| 1896 | 322 | public function getIdentifierColumnNames() |
|
| 1916 | |||
| 1917 | /** |
||
| 1918 | * Sets the type of Id generator to use for the mapped class. |
||
| 1919 | * |
||
| 1920 | * @param int $generatorType |
||
| 1921 | * |
||
| 1922 | * @return void |
||
| 1923 | */ |
||
| 1924 | 458 | public function setIdGeneratorType($generatorType) |
|
| 1928 | |||
| 1929 | /** |
||
| 1930 | * Checks whether the mapped class uses an Id generator. |
||
| 1931 | * |
||
| 1932 | * @return boolean TRUE if the mapped class uses an Id generator, FALSE otherwise. |
||
| 1933 | */ |
||
| 1934 | 393 | public function usesIdGenerator() |
|
| 1938 | |||
| 1939 | /** |
||
| 1940 | * @return boolean |
||
| 1941 | */ |
||
| 1942 | 1324 | public function isInheritanceTypeNone() |
|
| 1946 | |||
| 1947 | /** |
||
| 1948 | * Checks whether the mapped class uses the JOINED inheritance mapping strategy. |
||
| 1949 | * |
||
| 1950 | * @return boolean TRUE if the class participates in a JOINED inheritance mapping, |
||
| 1951 | * FALSE otherwise. |
||
| 1952 | */ |
||
| 1953 | 1049 | public function isInheritanceTypeJoined() |
|
| 1957 | |||
| 1958 | /** |
||
| 1959 | * Checks whether the mapped class uses the SINGLE_TABLE inheritance mapping strategy. |
||
| 1960 | * |
||
| 1961 | * @return boolean TRUE if the class participates in a SINGLE_TABLE inheritance mapping, |
||
| 1962 | * FALSE otherwise. |
||
| 1963 | */ |
||
| 1964 | 1221 | public function isInheritanceTypeSingleTable() |
|
| 1968 | |||
| 1969 | /** |
||
| 1970 | * Checks whether the mapped class uses the TABLE_PER_CLASS inheritance mapping strategy. |
||
| 1971 | * |
||
| 1972 | * @return boolean TRUE if the class participates in a TABLE_PER_CLASS inheritance mapping, |
||
| 1973 | * FALSE otherwise. |
||
| 1974 | */ |
||
| 1975 | 259 | public function isInheritanceTypeTablePerClass() |
|
| 1979 | |||
| 1980 | /** |
||
| 1981 | * Checks whether the class uses an identity column for the Id generation. |
||
| 1982 | * |
||
| 1983 | * @return boolean TRUE if the class uses the IDENTITY generator, FALSE otherwise. |
||
| 1984 | */ |
||
| 1985 | 1061 | public function isIdGeneratorIdentity() |
|
| 1989 | |||
| 1990 | /** |
||
| 1991 | * Checks whether the class uses a sequence for id generation. |
||
| 1992 | * |
||
| 1993 | * @return boolean TRUE if the class uses the SEQUENCE generator, FALSE otherwise. |
||
| 1994 | */ |
||
| 1995 | 312 | public function isIdGeneratorSequence() |
|
| 1999 | |||
| 2000 | /** |
||
| 2001 | * Checks whether the class uses a table for id generation. |
||
| 2002 | * |
||
| 2003 | * @return boolean TRUE if the class uses the TABLE generator, FALSE otherwise. |
||
| 2004 | */ |
||
| 2005 | 80 | public function isIdGeneratorTable() |
|
| 2009 | |||
| 2010 | /** |
||
| 2011 | * Checks whether the class has a natural identifier/pk (which means it does |
||
| 2012 | * not use any Id generator. |
||
| 2013 | * |
||
| 2014 | * @return boolean |
||
| 2015 | */ |
||
| 2016 | 73 | public function isIdentifierNatural() |
|
| 2020 | |||
| 2021 | /** |
||
| 2022 | * Checks whether the class use a UUID for id generation. |
||
| 2023 | * |
||
| 2024 | * @return boolean |
||
| 2025 | */ |
||
| 2026 | public function isIdentifierUuid() |
||
| 2030 | |||
| 2031 | /** |
||
| 2032 | * Gets the type of a field. |
||
| 2033 | * |
||
| 2034 | * @param string $fieldName |
||
| 2035 | * |
||
| 2036 | * @return \Doctrine\DBAL\Types\Type|string|null |
||
| 2037 | * |
||
| 2038 | * @todo 3.0 Remove this. PersisterHelper should fix it somehow |
||
| 2039 | */ |
||
| 2040 | 38 | public function getTypeOfField($fieldName) |
|
| 2046 | |||
| 2047 | /** |
||
| 2048 | * Gets the type of a column. |
||
| 2049 | * |
||
| 2050 | * @param string $columnName |
||
| 2051 | * |
||
| 2052 | * @return \Doctrine\DBAL\Types\Type|string|null |
||
| 2053 | * |
||
| 2054 | * @deprecated 3.0 remove this. this method is bogous and unreliable, since it cannot resolve the type of a column |
||
| 2055 | * that is derived by a referenced field on a different entity. |
||
| 2056 | */ |
||
| 2057 | public function getTypeOfColumn($columnName) |
||
| 2061 | |||
| 2062 | /** |
||
| 2063 | * Gets the name of the primary table. |
||
| 2064 | * |
||
| 2065 | * @return string |
||
| 2066 | */ |
||
| 2067 | 1463 | public function getTableName() |
|
| 2071 | |||
| 2072 | /** |
||
| 2073 | * Gets primary table's schema name. |
||
| 2074 | * |
||
| 2075 | * @return string|null |
||
| 2076 | */ |
||
| 2077 | 13 | public function getSchemaName() |
|
| 2081 | |||
| 2082 | /** |
||
| 2083 | * Gets the table name to use for temporary identifier tables of this class. |
||
| 2084 | * |
||
| 2085 | * @return string |
||
| 2086 | */ |
||
| 2087 | 7 | public function getTemporaryIdTableName() |
|
| 2092 | |||
| 2093 | /** |
||
| 2094 | * Sets the mapped subclasses of this class. |
||
| 2095 | * |
||
| 2096 | * @param array $subclasses The names of all mapped subclasses. |
||
| 2097 | * |
||
| 2098 | * @return void |
||
| 2099 | */ |
||
| 2100 | 2 | public function setSubclasses(array $subclasses) |
|
| 2106 | |||
| 2107 | /** |
||
| 2108 | * Sets the parent class names. |
||
| 2109 | * Assumes that the class names in the passed array are in the order: |
||
| 2110 | * directParent -> directParentParent -> directParentParentParent ... -> root. |
||
| 2111 | * |
||
| 2112 | * @param array $classNames |
||
| 2113 | * |
||
| 2114 | * @return void |
||
| 2115 | */ |
||
| 2116 | 410 | public function setParentClasses(array $classNames) |
|
| 2124 | |||
| 2125 | /** |
||
| 2126 | * Sets the inheritance type used by the class and its subclasses. |
||
| 2127 | * |
||
| 2128 | * @param integer $type |
||
| 2129 | * |
||
| 2130 | * @return void |
||
| 2131 | * |
||
| 2132 | * @throws MappingException |
||
| 2133 | */ |
||
| 2134 | 169 | public function setInheritanceType($type) |
|
| 2142 | |||
| 2143 | /** |
||
| 2144 | * Sets the association to override association mapping of property for an entity relationship. |
||
| 2145 | * |
||
| 2146 | * @param string $fieldName |
||
| 2147 | * @param array $overrideMapping |
||
| 2148 | * |
||
| 2149 | * @return void |
||
| 2150 | * |
||
| 2151 | * @throws MappingException |
||
| 2152 | */ |
||
| 2153 | 20 | public function setAssociationOverride($fieldName, array $overrideMapping) |
|
| 2196 | |||
| 2197 | /** |
||
| 2198 | * Sets the override for a mapped field. |
||
| 2199 | * |
||
| 2200 | * @param string $fieldName |
||
| 2201 | * @param array $overrideMapping |
||
| 2202 | * |
||
| 2203 | * @return void |
||
| 2204 | * |
||
| 2205 | * @throws MappingException |
||
| 2206 | */ |
||
| 2207 | 15 | public function setAttributeOverride($fieldName, array $overrideMapping) |
|
| 2239 | |||
| 2240 | /** |
||
| 2241 | * Checks whether a mapped field is inherited from an entity superclass. |
||
| 2242 | * |
||
| 2243 | * @param string $fieldName |
||
| 2244 | * |
||
| 2245 | * @return bool TRUE if the field is inherited, FALSE otherwise. |
||
| 2246 | */ |
||
| 2247 | 370 | public function isInheritedField($fieldName) |
|
| 2251 | |||
| 2252 | /** |
||
| 2253 | * Checks if this entity is the root in any entity-inheritance-hierarchy. |
||
| 2254 | * |
||
| 2255 | * @return bool |
||
| 2256 | */ |
||
| 2257 | 409 | public function isRootEntity() |
|
| 2261 | |||
| 2262 | /** |
||
| 2263 | * Checks whether a mapped association field is inherited from a superclass. |
||
| 2264 | * |
||
| 2265 | * @param string $fieldName |
||
| 2266 | * |
||
| 2267 | * @return boolean TRUE if the field is inherited, FALSE otherwise. |
||
| 2268 | */ |
||
| 2269 | 349 | public function isInheritedAssociation($fieldName) |
|
| 2273 | |||
| 2274 | 349 | public function isInheritedEmbeddedClass($fieldName) |
|
| 2278 | |||
| 2279 | /** |
||
| 2280 | * Sets the name of the primary table the class is mapped to. |
||
| 2281 | * |
||
| 2282 | * @param string $tableName The table name. |
||
| 2283 | * |
||
| 2284 | * @return void |
||
| 2285 | * |
||
| 2286 | * @deprecated Use {@link setPrimaryTable}. |
||
| 2287 | */ |
||
| 2288 | public function setTableName($tableName) |
||
| 2292 | |||
| 2293 | /** |
||
| 2294 | * Sets the primary table definition. The provided array supports the |
||
| 2295 | * following structure: |
||
| 2296 | * |
||
| 2297 | * name => <tableName> (optional, defaults to class name) |
||
| 2298 | * indexes => array of indexes (optional) |
||
| 2299 | * uniqueConstraints => array of constraints (optional) |
||
| 2300 | * |
||
| 2301 | * If a key is omitted, the current value is kept. |
||
| 2302 | * |
||
| 2303 | * @param array $table The table description. |
||
| 2304 | * |
||
| 2305 | * @return void |
||
| 2306 | */ |
||
| 2307 | 325 | public function setPrimaryTable(array $table) |
|
| 2339 | |||
| 2340 | /** |
||
| 2341 | * Checks whether the given type identifies an inheritance type. |
||
| 2342 | * |
||
| 2343 | * @param integer $type |
||
| 2344 | * |
||
| 2345 | * @return boolean TRUE if the given type identifies an inheritance type, FALSe otherwise. |
||
| 2346 | */ |
||
| 2347 | 169 | private function _isInheritanceType($type) |
|
| 2354 | |||
| 2355 | /** |
||
| 2356 | * Adds a mapped field to the class. |
||
| 2357 | * |
||
| 2358 | * @param array $mapping The field mapping. |
||
| 2359 | * |
||
| 2360 | * @return void |
||
| 2361 | * |
||
| 2362 | * @throws MappingException |
||
| 2363 | */ |
||
| 2364 | 529 | public function mapField(array $mapping) |
|
| 2371 | |||
| 2372 | /** |
||
| 2373 | * INTERNAL: |
||
| 2374 | * Adds an association mapping without completing/validating it. |
||
| 2375 | * This is mainly used to add inherited association mappings to derived classes. |
||
| 2376 | * |
||
| 2377 | * @param array $mapping |
||
| 2378 | * |
||
| 2379 | * @return void |
||
| 2380 | * |
||
| 2381 | * @throws MappingException |
||
| 2382 | */ |
||
| 2383 | 48 | public function addInheritedAssociationMapping(array $mapping/*, $owningClassName = null*/) |
|
| 2390 | |||
| 2391 | /** |
||
| 2392 | * INTERNAL: |
||
| 2393 | * Adds a field mapping without completing/validating it. |
||
| 2394 | * This is mainly used to add inherited field mappings to derived classes. |
||
| 2395 | * |
||
| 2396 | * @param array $fieldMapping |
||
| 2397 | * |
||
| 2398 | * @return void |
||
| 2399 | */ |
||
| 2400 | 107 | public function addInheritedFieldMapping(array $fieldMapping) |
|
| 2406 | |||
| 2407 | /** |
||
| 2408 | * INTERNAL: |
||
| 2409 | * Adds a named query to this class. |
||
| 2410 | * |
||
| 2411 | * @param array $queryMapping |
||
| 2412 | * |
||
| 2413 | * @return void |
||
| 2414 | * |
||
| 2415 | * @throws MappingException |
||
| 2416 | */ |
||
| 2417 | 29 | public function addNamedQuery(array $queryMapping) |
|
| 2441 | |||
| 2442 | /** |
||
| 2443 | * INTERNAL: |
||
| 2444 | * Adds a named native query to this class. |
||
| 2445 | * |
||
| 2446 | * @param array $queryMapping |
||
| 2447 | * |
||
| 2448 | * @return void |
||
| 2449 | * |
||
| 2450 | * @throws MappingException |
||
| 2451 | */ |
||
| 2452 | 39 | public function addNamedNativeQuery(array $queryMapping) |
|
| 2485 | |||
| 2486 | /** |
||
| 2487 | * INTERNAL: |
||
| 2488 | * Adds a sql result set mapping to this class. |
||
| 2489 | * |
||
| 2490 | * @param array $resultMapping |
||
| 2491 | * |
||
| 2492 | * @return void |
||
| 2493 | * |
||
| 2494 | * @throws MappingException |
||
| 2495 | */ |
||
| 2496 | 39 | public function addSqlResultSetMapping(array $resultMapping) |
|
| 2546 | |||
| 2547 | /** |
||
| 2548 | * Adds a one-to-one mapping. |
||
| 2549 | * |
||
| 2550 | * @param array $mapping The mapping. |
||
| 2551 | * |
||
| 2552 | * @return void |
||
| 2553 | */ |
||
| 2554 | 167 | public function mapOneToOne(array $mapping) |
|
| 2562 | |||
| 2563 | /** |
||
| 2564 | * Adds a one-to-many mapping. |
||
| 2565 | * |
||
| 2566 | * @param array $mapping The mapping. |
||
| 2567 | * |
||
| 2568 | * @return void |
||
| 2569 | */ |
||
| 2570 | 129 | public function mapOneToMany(array $mapping) |
|
| 2578 | |||
| 2579 | /** |
||
| 2580 | * Adds a many-to-one mapping. |
||
| 2581 | * |
||
| 2582 | * @param array $mapping The mapping. |
||
| 2583 | * |
||
| 2584 | * @return void |
||
| 2585 | */ |
||
| 2586 | 164 | public function mapManyToOne(array $mapping) |
|
| 2595 | |||
| 2596 | /** |
||
| 2597 | * Adds a many-to-many mapping. |
||
| 2598 | * |
||
| 2599 | * @param array $mapping The mapping. |
||
| 2600 | * |
||
| 2601 | * @return void |
||
| 2602 | */ |
||
| 2603 | 150 | public function mapManyToMany(array $mapping) |
|
| 2611 | |||
| 2612 | /** |
||
| 2613 | * Stores the association mapping. |
||
| 2614 | * |
||
| 2615 | * @param array $assocMapping |
||
| 2616 | * |
||
| 2617 | * @return void |
||
| 2618 | * |
||
| 2619 | * @throws MappingException |
||
| 2620 | */ |
||
| 2621 | 341 | protected function _storeAssociationMapping(array $assocMapping) |
|
| 2629 | |||
| 2630 | /** |
||
| 2631 | * Registers a custom repository class for the entity class. |
||
| 2632 | * |
||
| 2633 | * @param string $repositoryClassName The class name of the custom mapper. |
||
| 2634 | * |
||
| 2635 | * @return void |
||
| 2636 | */ |
||
| 2637 | 62 | public function setCustomRepositoryClass($repositoryClassName) |
|
| 2641 | |||
| 2642 | /** |
||
| 2643 | * @param string $collectionClassName |
||
| 2644 | * |
||
| 2645 | * @return void |
||
| 2646 | */ |
||
| 2647 | 8 | public function setCustomCollectionClass($collectionClassName) |
|
| 2651 | |||
| 2652 | /** |
||
| 2653 | * Dispatches the lifecycle event of the given entity to the registered |
||
| 2654 | * lifecycle callbacks and lifecycle listeners. |
||
| 2655 | * |
||
| 2656 | * @deprecated Deprecated since version 2.4 in favor of \Doctrine\ORM\Event\ListenersInvoker |
||
| 2657 | * |
||
| 2658 | * @param string $lifecycleEvent The lifecycle event. |
||
| 2659 | * @param object $entity The Entity on which the event occurred. |
||
| 2660 | * |
||
| 2661 | * @return void |
||
| 2662 | */ |
||
| 2663 | public function invokeLifecycleCallbacks($lifecycleEvent, $entity) |
||
| 2669 | |||
| 2670 | /** |
||
| 2671 | * Whether the class has any attached lifecycle listeners or callbacks for a lifecycle event. |
||
| 2672 | * |
||
| 2673 | * @param string $lifecycleEvent |
||
| 2674 | * |
||
| 2675 | * @return boolean |
||
| 2676 | */ |
||
| 2677 | public function hasLifecycleCallbacks($lifecycleEvent) |
||
| 2681 | |||
| 2682 | /** |
||
| 2683 | * Gets the registered lifecycle callbacks for an event. |
||
| 2684 | * |
||
| 2685 | * @param string $event |
||
| 2686 | * |
||
| 2687 | * @return array |
||
| 2688 | */ |
||
| 2689 | public function getLifecycleCallbacks($event) |
||
| 2693 | |||
| 2694 | /** |
||
| 2695 | * Adds a lifecycle callback for entities of this class. |
||
| 2696 | * |
||
| 2697 | * @param string $callback |
||
| 2698 | * @param string $event |
||
| 2699 | * |
||
| 2700 | * @return void |
||
| 2701 | */ |
||
| 2702 | 41 | public function addLifecycleCallback($callback, $event) |
|
| 2710 | |||
| 2711 | /** |
||
| 2712 | * Sets the lifecycle callbacks for entities of this class. |
||
| 2713 | * Any previously registered callbacks are overwritten. |
||
| 2714 | * |
||
| 2715 | * @param array $callbacks |
||
| 2716 | * |
||
| 2717 | * @return void |
||
| 2718 | */ |
||
| 2719 | 122 | public function setLifecycleCallbacks(array $callbacks) |
|
| 2723 | |||
| 2724 | /** |
||
| 2725 | * Adds a entity listener for entities of this class. |
||
| 2726 | * |
||
| 2727 | * @param string $eventName The entity lifecycle event. |
||
| 2728 | * @param string $class The listener class. |
||
| 2729 | * @param string $method The listener callback method. |
||
| 2730 | * |
||
| 2731 | * @throws \Doctrine\ORM\Mapping\MappingException |
||
| 2732 | */ |
||
| 2733 | 35 | public function addEntityListener($eventName, $class, $method) |
|
| 2756 | |||
| 2757 | /** |
||
| 2758 | * Sets the discriminator column definition. |
||
| 2759 | * |
||
| 2760 | * @param array $columnDef |
||
| 2761 | * |
||
| 2762 | * @return void |
||
| 2763 | * |
||
| 2764 | * @throws MappingException |
||
| 2765 | * |
||
| 2766 | * @see getDiscriminatorColumn() |
||
| 2767 | */ |
||
| 2768 | 163 | public function setDiscriminatorColumn($columnDef) |
|
| 2794 | |||
| 2795 | /** |
||
| 2796 | * Sets the discriminator values used by this class. |
||
| 2797 | * Used for JOINED and SINGLE_TABLE inheritance mapping strategies. |
||
| 2798 | * |
||
| 2799 | * @param array $map |
||
| 2800 | * |
||
| 2801 | * @return void |
||
| 2802 | */ |
||
| 2803 | 156 | public function setDiscriminatorMap(array $map) |
|
| 2809 | |||
| 2810 | /** |
||
| 2811 | * Adds one entry of the discriminator map with a new class and corresponding name. |
||
| 2812 | * |
||
| 2813 | * @param string $name |
||
| 2814 | * @param string $className |
||
| 2815 | * |
||
| 2816 | * @return void |
||
| 2817 | * |
||
| 2818 | * @throws MappingException |
||
| 2819 | */ |
||
| 2820 | 104 | public function addDiscriminatorMapClass($name, $className) |
|
| 2841 | |||
| 2842 | /** |
||
| 2843 | * Checks whether the class has a named query with the given query name. |
||
| 2844 | * |
||
| 2845 | * @param string $queryName |
||
| 2846 | * |
||
| 2847 | * @return boolean |
||
| 2848 | */ |
||
| 2849 | 1 | public function hasNamedQuery($queryName) |
|
| 2853 | |||
| 2854 | /** |
||
| 2855 | * Checks whether the class has a named native query with the given query name. |
||
| 2856 | * |
||
| 2857 | * @param string $queryName |
||
| 2858 | * |
||
| 2859 | * @return boolean |
||
| 2860 | */ |
||
| 2861 | 1 | public function hasNamedNativeQuery($queryName) |
|
| 2865 | |||
| 2866 | /** |
||
| 2867 | * Checks whether the class has a named native query with the given query name. |
||
| 2868 | * |
||
| 2869 | * @param string $name |
||
| 2870 | * |
||
| 2871 | * @return boolean |
||
| 2872 | */ |
||
| 2873 | 1 | public function hasSqlResultSetMapping($name) |
|
| 2877 | |||
| 2878 | /** |
||
| 2879 | * {@inheritDoc} |
||
| 2880 | */ |
||
| 2881 | 341 | public function hasAssociation($fieldName) |
|
| 2885 | |||
| 2886 | /** |
||
| 2887 | * {@inheritDoc} |
||
| 2888 | */ |
||
| 2889 | 1 | public function isSingleValuedAssociation($fieldName) |
|
| 2894 | |||
| 2895 | /** |
||
| 2896 | * {@inheritDoc} |
||
| 2897 | */ |
||
| 2898 | 1024 | public function isCollectionValuedAssociation($fieldName) |
|
| 2903 | |||
| 2904 | /** |
||
| 2905 | * Is this an association that only has a single join column? |
||
| 2906 | * |
||
| 2907 | * @param string $fieldName |
||
| 2908 | * |
||
| 2909 | * @return bool |
||
| 2910 | */ |
||
| 2911 | 35 | public function isAssociationWithSingleJoinColumn($fieldName) |
|
| 2917 | |||
| 2918 | /** |
||
| 2919 | * Returns the single association join column (if any). |
||
| 2920 | * |
||
| 2921 | * @param string $fieldName |
||
| 2922 | * |
||
| 2923 | * @return string |
||
| 2924 | * |
||
| 2925 | * @throws MappingException |
||
| 2926 | */ |
||
| 2927 | 9 | public function getSingleAssociationJoinColumnName($fieldName) |
|
| 2935 | |||
| 2936 | /** |
||
| 2937 | * Returns the single association referenced join column name (if any). |
||
| 2938 | * |
||
| 2939 | * @param string $fieldName |
||
| 2940 | * |
||
| 2941 | * @return string |
||
| 2942 | * |
||
| 2943 | * @throws MappingException |
||
| 2944 | */ |
||
| 2945 | 9 | public function getSingleAssociationReferencedJoinColumnName($fieldName) |
|
| 2953 | |||
| 2954 | /** |
||
| 2955 | * Used to retrieve a fieldname for either field or association from a given column. |
||
| 2956 | * |
||
| 2957 | * This method is used in foreign-key as primary-key contexts. |
||
| 2958 | * |
||
| 2959 | * @param string $columnName |
||
| 2960 | * |
||
| 2961 | * @return string |
||
| 2962 | * |
||
| 2963 | * @throws MappingException |
||
| 2964 | */ |
||
| 2965 | 633 | public function getFieldForColumn($columnName) |
|
| 2981 | |||
| 2982 | /** |
||
| 2983 | * Sets the ID generator used to generate IDs for instances of this class. |
||
| 2984 | * |
||
| 2985 | * @param \Doctrine\ORM\Id\AbstractIdGenerator $generator |
||
| 2986 | * |
||
| 2987 | * @return void |
||
| 2988 | */ |
||
| 2989 | 412 | public function setIdGenerator($generator) |
|
| 2993 | |||
| 2994 | /** |
||
| 2995 | * Sets definition. |
||
| 2996 | * |
||
| 2997 | * @param array $definition |
||
| 2998 | * |
||
| 2999 | * @return void |
||
| 3000 | */ |
||
| 3001 | 12 | public function setCustomGeneratorDefinition(array $definition) |
|
| 3005 | |||
| 3006 | /** |
||
| 3007 | * Sets the definition of the sequence ID generator for this class. |
||
| 3008 | * |
||
| 3009 | * The definition must have the following structure: |
||
| 3010 | * <code> |
||
| 3011 | * array( |
||
| 3012 | * 'sequenceName' => 'name', |
||
| 3013 | * 'allocationSize' => 20, |
||
| 3014 | * 'initialValue' => 1 |
||
| 3015 | * 'quoted' => 1 |
||
| 3016 | * ) |
||
| 3017 | * </code> |
||
| 3018 | * |
||
| 3019 | * @param array $definition |
||
| 3020 | * |
||
| 3021 | * @return void |
||
| 3022 | * |
||
| 3023 | * @throws MappingException |
||
| 3024 | */ |
||
| 3025 | 23 | public function setSequenceGeneratorDefinition(array $definition) |
|
| 3038 | |||
| 3039 | /** |
||
| 3040 | * Sets the version field mapping used for versioning. Sets the default |
||
| 3041 | * value to use depending on the column type. |
||
| 3042 | * |
||
| 3043 | * @param array $mapping The version field mapping array. |
||
| 3044 | * |
||
| 3045 | * @return void |
||
| 3046 | * |
||
| 3047 | * @throws MappingException |
||
| 3048 | */ |
||
| 3049 | 25 | public function setVersionMapping(array &$mapping) |
|
| 3064 | |||
| 3065 | /** |
||
| 3066 | * Sets whether this class is to be versioned for optimistic locking. |
||
| 3067 | * |
||
| 3068 | * @param boolean $bool |
||
| 3069 | * |
||
| 3070 | * @return void |
||
| 3071 | */ |
||
| 3072 | 122 | public function setVersioned($bool) |
|
| 3076 | |||
| 3077 | /** |
||
| 3078 | * Sets the name of the field that is to be used for versioning if this class is |
||
| 3079 | * versioned for optimistic locking. |
||
| 3080 | * |
||
| 3081 | * @param string $versionField |
||
| 3082 | * |
||
| 3083 | * @return void |
||
| 3084 | */ |
||
| 3085 | 122 | public function setVersionField($versionField) |
|
| 3089 | |||
| 3090 | /** |
||
| 3091 | * Marks this class as read only, no change tracking is applied to it. |
||
| 3092 | * |
||
| 3093 | * @return void |
||
| 3094 | */ |
||
| 3095 | 3 | public function markReadOnly() |
|
| 3099 | |||
| 3100 | /** |
||
| 3101 | * {@inheritDoc} |
||
| 3102 | */ |
||
| 3103 | public function getFieldNames() |
||
| 3107 | |||
| 3108 | /** |
||
| 3109 | * {@inheritDoc} |
||
| 3110 | */ |
||
| 3111 | public function getAssociationNames() |
||
| 3115 | |||
| 3116 | /** |
||
| 3117 | * {@inheritDoc} |
||
| 3118 | * |
||
| 3119 | * @throws InvalidArgumentException |
||
| 3120 | */ |
||
| 3121 | 1 | public function getAssociationTargetClass($assocName) |
|
| 3129 | |||
| 3130 | /** |
||
| 3131 | * {@inheritDoc} |
||
| 3132 | */ |
||
| 3133 | 709 | public function getName() |
|
| 3137 | |||
| 3138 | /** |
||
| 3139 | * Gets the (possibly quoted) identifier column names for safe use in an SQL statement. |
||
| 3140 | * |
||
| 3141 | * @deprecated Deprecated since version 2.3 in favor of \Doctrine\ORM\Mapping\QuoteStrategy |
||
| 3142 | * |
||
| 3143 | * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform |
||
| 3144 | * |
||
| 3145 | * @return array |
||
| 3146 | */ |
||
| 3147 | public function getQuotedIdentifierColumnNames($platform) |
||
| 3176 | |||
| 3177 | /** |
||
| 3178 | * Gets the (possibly quoted) column name of a mapped field for safe use in an SQL statement. |
||
| 3179 | * |
||
| 3180 | * @deprecated Deprecated since version 2.3 in favor of \Doctrine\ORM\Mapping\QuoteStrategy |
||
| 3181 | * |
||
| 3182 | * @param string $field |
||
| 3183 | * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform |
||
| 3184 | * |
||
| 3185 | * @return string |
||
| 3186 | */ |
||
| 3187 | public function getQuotedColumnName($field, $platform) |
||
| 3193 | |||
| 3194 | /** |
||
| 3195 | * Gets the (possibly quoted) primary table name of this class for safe use in an SQL statement. |
||
| 3196 | * |
||
| 3197 | * @deprecated Deprecated since version 2.3 in favor of \Doctrine\ORM\Mapping\QuoteStrategy |
||
| 3198 | * |
||
| 3199 | * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform |
||
| 3200 | * |
||
| 3201 | * @return string |
||
| 3202 | */ |
||
| 3203 | public function getQuotedTableName($platform) |
||
| 3209 | |||
| 3210 | /** |
||
| 3211 | * Gets the (possibly quoted) name of the join table. |
||
| 3212 | * |
||
| 3213 | * @deprecated Deprecated since version 2.3 in favor of \Doctrine\ORM\Mapping\QuoteStrategy |
||
| 3214 | * |
||
| 3215 | * @param array $assoc |
||
| 3216 | * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform |
||
| 3217 | * |
||
| 3218 | * @return string |
||
| 3219 | */ |
||
| 3220 | public function getQuotedJoinTableName(array $assoc, $platform) |
||
| 3226 | |||
| 3227 | /** |
||
| 3228 | * {@inheritDoc} |
||
| 3229 | */ |
||
| 3230 | 12 | public function isAssociationInverseSide($fieldName) |
|
| 3235 | |||
| 3236 | /** |
||
| 3237 | * {@inheritDoc} |
||
| 3238 | */ |
||
| 3239 | public function getAssociationMappedByTargetField($fieldName) |
||
| 3243 | |||
| 3244 | /** |
||
| 3245 | * @param string $targetClass |
||
| 3246 | * |
||
| 3247 | * @return array |
||
| 3248 | */ |
||
| 3249 | 2 | public function getAssociationsByTargetClass($targetClass) |
|
| 3261 | |||
| 3262 | /** |
||
| 3263 | * @param string|null $className |
||
| 3264 | * |
||
| 3265 | * @return string|null null if the input value is null |
||
| 3266 | */ |
||
| 3267 | 482 | public function fullyQualifiedClassName($className) |
|
| 3279 | |||
| 3280 | /** |
||
| 3281 | * @param string $name |
||
| 3282 | * |
||
| 3283 | * @return mixed |
||
| 3284 | */ |
||
| 3285 | 2 | public function getMetadataValue($name) |
|
| 3294 | |||
| 3295 | /** |
||
| 3296 | * Map Embedded Class |
||
| 3297 | * |
||
| 3298 | * @param array $mapping |
||
| 3299 | * |
||
| 3300 | * @throws MappingException |
||
| 3301 | * @return void |
||
| 3302 | */ |
||
| 3303 | 26 | public function mapEmbedded(array $mapping) |
|
| 3314 | |||
| 3315 | /** |
||
| 3316 | * Inline the embeddable class |
||
| 3317 | * |
||
| 3318 | * @param string $property |
||
| 3319 | * @param ClassMetadataInfo $embeddable |
||
| 3320 | */ |
||
| 3321 | 10 | public function inlineEmbeddable($property, ClassMetadataInfo $embeddable) |
|
| 3350 | |||
| 3351 | /** |
||
| 3352 | * @param string $fieldName |
||
| 3353 | * @throws MappingException |
||
| 3354 | */ |
||
| 3355 | 564 | private function assertFieldNotMapped($fieldName) |
|
| 3364 | |||
| 3365 | /** |
||
| 3366 | * Gets the sequence name based on class metadata. |
||
| 3367 | * |
||
| 3368 | * @param AbstractPlatform $platform |
||
| 3369 | * @return string |
||
| 3370 | * |
||
| 3371 | * @todo Sequence names should be computed in DBAL depending on the platform |
||
| 3372 | */ |
||
| 3373 | 3 | public function getSequenceName(AbstractPlatform $platform) |
|
| 3381 | |||
| 3382 | /** |
||
| 3383 | * Gets the sequence name prefix based on class metadata. |
||
| 3384 | * |
||
| 3385 | * @param AbstractPlatform $platform |
||
| 3386 | * @return string |
||
| 3387 | * |
||
| 3388 | * @todo Sequence names should be computed in DBAL depending on the platform |
||
| 3389 | */ |
||
| 3390 | 3 | public function getSequencePrefix(AbstractPlatform $platform) |
|
| 3406 | } |
||
| 3407 |
Let’s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let’s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: