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 | * READ-ONLY: Whether this class describes the mapping of a mapped superclass. |
||
| 261 | * |
||
| 262 | * @var boolean |
||
| 263 | */ |
||
| 264 | public $isMappedSuperclass = false; |
||
| 265 | |||
| 266 | /** |
||
| 267 | * READ-ONLY: Whether this class describes the mapping of an embeddable class. |
||
| 268 | * |
||
| 269 | * @var boolean |
||
| 270 | */ |
||
| 271 | public $isEmbeddedClass = false; |
||
| 272 | |||
| 273 | /** |
||
| 274 | * READ-ONLY: The names of the parent classes (ancestors). |
||
| 275 | * |
||
| 276 | * @var array |
||
| 277 | */ |
||
| 278 | public $parentClasses = array(); |
||
| 279 | |||
| 280 | /** |
||
| 281 | * READ-ONLY: The names of all subclasses (descendants). |
||
| 282 | * |
||
| 283 | * @var array |
||
| 284 | */ |
||
| 285 | public $subClasses = array(); |
||
| 286 | |||
| 287 | /** |
||
| 288 | * READ-ONLY: The names of all embedded classes based on properties. |
||
| 289 | * |
||
| 290 | * @var array |
||
| 291 | */ |
||
| 292 | public $embeddedClasses = array(); |
||
| 293 | |||
| 294 | /** |
||
| 295 | * READ-ONLY: The named queries allowed to be called directly from Repository. |
||
| 296 | * |
||
| 297 | * @var array |
||
| 298 | */ |
||
| 299 | public $namedQueries = array(); |
||
| 300 | |||
| 301 | /** |
||
| 302 | * READ-ONLY: The named native queries allowed to be called directly from Repository. |
||
| 303 | * |
||
| 304 | * A native SQL named query definition has the following structure: |
||
| 305 | * <pre> |
||
| 306 | * array( |
||
| 307 | * 'name' => <query name>, |
||
| 308 | * 'query' => <sql query>, |
||
| 309 | * 'resultClass' => <class of the result>, |
||
| 310 | * 'resultSetMapping' => <name of a SqlResultSetMapping> |
||
| 311 | * ) |
||
| 312 | * </pre> |
||
| 313 | * |
||
| 314 | * @var array |
||
| 315 | */ |
||
| 316 | public $namedNativeQueries = array(); |
||
| 317 | |||
| 318 | /** |
||
| 319 | * READ-ONLY: The mappings of the results of native SQL queries. |
||
| 320 | * |
||
| 321 | * A native result mapping definition has the following structure: |
||
| 322 | * <pre> |
||
| 323 | * array( |
||
| 324 | * 'name' => <result name>, |
||
| 325 | * 'entities' => array(<entity result mapping>), |
||
| 326 | * 'columns' => array(<column result mapping>) |
||
| 327 | * ) |
||
| 328 | * </pre> |
||
| 329 | * |
||
| 330 | * @var array |
||
| 331 | */ |
||
| 332 | public $sqlResultSetMappings = array(); |
||
| 333 | |||
| 334 | /** |
||
| 335 | * READ-ONLY: The field names of all fields that are part of the identifier/primary key |
||
| 336 | * of the mapped entity class. |
||
| 337 | * |
||
| 338 | * @var array |
||
| 339 | */ |
||
| 340 | public $identifier = array(); |
||
| 341 | |||
| 342 | /** |
||
| 343 | * READ-ONLY: The inheritance mapping type used by the class. |
||
| 344 | * |
||
| 345 | * @var integer |
||
| 346 | */ |
||
| 347 | public $inheritanceType = self::INHERITANCE_TYPE_NONE; |
||
| 348 | |||
| 349 | /** |
||
| 350 | * READ-ONLY: The Id generator type used by the class. |
||
| 351 | * |
||
| 352 | * @var int |
||
| 353 | */ |
||
| 354 | public $generatorType = self::GENERATOR_TYPE_NONE; |
||
| 355 | |||
| 356 | /** |
||
| 357 | * READ-ONLY: The field mappings of the class. |
||
| 358 | * Keys are field names and values are mapping definitions. |
||
| 359 | * |
||
| 360 | * The mapping definition array has the following values: |
||
| 361 | * |
||
| 362 | * - <b>fieldName</b> (string) |
||
| 363 | * The name of the field in the Entity. |
||
| 364 | * |
||
| 365 | * - <b>type</b> (string) |
||
| 366 | * The type name of the mapped field. Can be one of Doctrine's mapping types |
||
| 367 | * or a custom mapping type. |
||
| 368 | * |
||
| 369 | * - <b>columnName</b> (string, optional) |
||
| 370 | * The column name. Optional. Defaults to the field name. |
||
| 371 | * |
||
| 372 | * - <b>length</b> (integer, optional) |
||
| 373 | * The database length of the column. Optional. Default value taken from |
||
| 374 | * the type. |
||
| 375 | * |
||
| 376 | * - <b>id</b> (boolean, optional) |
||
| 377 | * Marks the field as the primary key of the entity. Multiple fields of an |
||
| 378 | * entity can have the id attribute, forming a composite key. |
||
| 379 | * |
||
| 380 | * - <b>nullable</b> (boolean, optional) |
||
| 381 | * Whether the column is nullable. Defaults to FALSE. |
||
| 382 | * |
||
| 383 | * - <b>readOnly</b> (boolean, optional) |
||
| 384 | * Whether the column is readOnly. Defaults to FALSE. |
||
| 385 | * |
||
| 386 | * - <b>columnDefinition</b> (string, optional, schema-only) |
||
| 387 | * The SQL fragment that is used when generating the DDL for the column. |
||
| 388 | * |
||
| 389 | * - <b>precision</b> (integer, optional, schema-only) |
||
| 390 | * The precision of a decimal column. Only valid if the column type is decimal. |
||
| 391 | * |
||
| 392 | * - <b>scale</b> (integer, optional, schema-only) |
||
| 393 | * The scale of a decimal column. Only valid if the column type is decimal. |
||
| 394 | * |
||
| 395 | * - <b>'unique'</b> (string, optional, schema-only) |
||
| 396 | * Whether a unique constraint should be generated for the column. |
||
| 397 | * |
||
| 398 | * @var array |
||
| 399 | */ |
||
| 400 | public $fieldMappings = array(); |
||
| 401 | |||
| 402 | /** |
||
| 403 | * READ-ONLY: An array of field names. Used to look up field names from column names. |
||
| 404 | * Keys are column names and values are field names. |
||
| 405 | * |
||
| 406 | * @var array |
||
| 407 | */ |
||
| 408 | public $fieldNames = array(); |
||
| 409 | |||
| 410 | /** |
||
| 411 | * READ-ONLY: A map of field names to column names. Keys are field names and values column names. |
||
| 412 | * Used to look up column names from field names. |
||
| 413 | * This is the reverse lookup map of $_fieldNames. |
||
| 414 | * |
||
| 415 | * @var array |
||
| 416 | * |
||
| 417 | * @deprecated 3.0 Remove this. |
||
| 418 | */ |
||
| 419 | public $columnNames = array(); |
||
| 420 | |||
| 421 | /** |
||
| 422 | * READ-ONLY: The discriminator value of this class. |
||
| 423 | * |
||
| 424 | * <b>This does only apply to the JOINED and SINGLE_TABLE inheritance mapping strategies |
||
| 425 | * where a discriminator column is used.</b> |
||
| 426 | * |
||
| 427 | * @var mixed |
||
| 428 | * |
||
| 429 | * @see discriminatorColumn |
||
| 430 | */ |
||
| 431 | public $discriminatorValue; |
||
| 432 | |||
| 433 | /** |
||
| 434 | * READ-ONLY: The discriminator map of all mapped classes in the hierarchy. |
||
| 435 | * |
||
| 436 | * <b>This does only apply to the JOINED and SINGLE_TABLE inheritance mapping strategies |
||
| 437 | * where a discriminator column is used.</b> |
||
| 438 | * |
||
| 439 | * @var mixed |
||
| 440 | * |
||
| 441 | * @see discriminatorColumn |
||
| 442 | */ |
||
| 443 | public $discriminatorMap = array(); |
||
| 444 | |||
| 445 | /** |
||
| 446 | * READ-ONLY: The definition of the discriminator column used in JOINED and SINGLE_TABLE |
||
| 447 | * inheritance mappings. |
||
| 448 | * |
||
| 449 | * @var array |
||
| 450 | */ |
||
| 451 | public $discriminatorColumn; |
||
| 452 | |||
| 453 | /** |
||
| 454 | * READ-ONLY: The primary table definition. The definition is an array with the |
||
| 455 | * following entries: |
||
| 456 | * |
||
| 457 | * name => <tableName> |
||
| 458 | * schema => <schemaName> |
||
| 459 | * indexes => array |
||
| 460 | * uniqueConstraints => array |
||
| 461 | * |
||
| 462 | * @var array |
||
| 463 | */ |
||
| 464 | public $table; |
||
| 465 | |||
| 466 | /** |
||
| 467 | * READ-ONLY: The registered lifecycle callbacks for entities of this class. |
||
| 468 | * |
||
| 469 | * @var array |
||
| 470 | */ |
||
| 471 | public $lifecycleCallbacks = array(); |
||
| 472 | |||
| 473 | /** |
||
| 474 | * READ-ONLY: The registered entity listeners. |
||
| 475 | * |
||
| 476 | * @var array |
||
| 477 | */ |
||
| 478 | public $entityListeners = array(); |
||
| 479 | |||
| 480 | /** |
||
| 481 | * READ-ONLY: The association mappings of this class. |
||
| 482 | * |
||
| 483 | * The mapping definition array supports the following keys: |
||
| 484 | * |
||
| 485 | * - <b>fieldName</b> (string) |
||
| 486 | * The name of the field in the entity the association is mapped to. |
||
| 487 | * |
||
| 488 | * - <b>targetEntity</b> (string) |
||
| 489 | * The class name of the target entity. If it is fully-qualified it is used as is. |
||
| 490 | * If it is a simple, unqualified class name the namespace is assumed to be the same |
||
| 491 | * as the namespace of the source entity. |
||
| 492 | * |
||
| 493 | * - <b>mappedBy</b> (string, required for bidirectional associations) |
||
| 494 | * The name of the field that completes the bidirectional association on the owning side. |
||
| 495 | * This key must be specified on the inverse side of a bidirectional association. |
||
| 496 | * |
||
| 497 | * - <b>inversedBy</b> (string, required for bidirectional associations) |
||
| 498 | * The name of the field that completes the bidirectional association on the inverse side. |
||
| 499 | * This key must be specified on the owning side of a bidirectional association. |
||
| 500 | * |
||
| 501 | * - <b>cascade</b> (array, optional) |
||
| 502 | * The names of persistence operations to cascade on the association. The set of possible |
||
| 503 | * values are: "persist", "remove", "detach", "merge", "refresh", "all" (implies all others). |
||
| 504 | * |
||
| 505 | * - <b>orderBy</b> (array, one-to-many/many-to-many only) |
||
| 506 | * A map of field names (of the target entity) to sorting directions (ASC/DESC). |
||
| 507 | * Example: array('priority' => 'desc') |
||
| 508 | * |
||
| 509 | * - <b>fetch</b> (integer, optional) |
||
| 510 | * The fetching strategy to use for the association, usually defaults to FETCH_LAZY. |
||
| 511 | * Possible values are: ClassMetadata::FETCH_EAGER, ClassMetadata::FETCH_LAZY. |
||
| 512 | * |
||
| 513 | * - <b>joinTable</b> (array, optional, many-to-many only) |
||
| 514 | * Specification of the join table and its join columns (foreign keys). |
||
| 515 | * Only valid for many-to-many mappings. Note that one-to-many associations can be mapped |
||
| 516 | * through a join table by simply mapping the association as many-to-many with a unique |
||
| 517 | * constraint on the join table. |
||
| 518 | * |
||
| 519 | * - <b>indexBy</b> (string, optional, to-many only) |
||
| 520 | * Specification of a field on target-entity that is used to index the collection by. |
||
| 521 | * This field HAS to be either the primary key or a unique column. Otherwise the collection |
||
| 522 | * does not contain all the entities that are actually related. |
||
| 523 | * |
||
| 524 | * A join table definition has the following structure: |
||
| 525 | * <pre> |
||
| 526 | * array( |
||
| 527 | * 'name' => <join table name>, |
||
| 528 | * 'joinColumns' => array(<join column mapping from join table to source table>), |
||
| 529 | * 'inverseJoinColumns' => array(<join column mapping from join table to target table>) |
||
| 530 | * ) |
||
| 531 | * </pre> |
||
| 532 | * |
||
| 533 | * @var array |
||
| 534 | */ |
||
| 535 | public $associationMappings = array(); |
||
| 536 | |||
| 537 | /** |
||
| 538 | * READ-ONLY: Flag indicating whether the identifier/primary key of the class is composite. |
||
| 539 | * |
||
| 540 | * @var boolean |
||
| 541 | */ |
||
| 542 | public $isIdentifierComposite = false; |
||
| 543 | |||
| 544 | /** |
||
| 545 | * READ-ONLY: Flag indicating whether the identifier/primary key contains at least one foreign key association. |
||
| 546 | * |
||
| 547 | * This flag is necessary because some code blocks require special treatment of this cases. |
||
| 548 | * |
||
| 549 | * @var boolean |
||
| 550 | */ |
||
| 551 | public $containsForeignIdentifier = false; |
||
| 552 | |||
| 553 | /** |
||
| 554 | * READ-ONLY: The ID generator used for generating IDs for this class. |
||
| 555 | * |
||
| 556 | * @var \Doctrine\ORM\Id\AbstractIdGenerator |
||
| 557 | * |
||
| 558 | * @todo Remove! |
||
| 559 | */ |
||
| 560 | public $idGenerator; |
||
| 561 | |||
| 562 | /** |
||
| 563 | * READ-ONLY: The definition of the sequence generator of this class. Only used for the |
||
| 564 | * SEQUENCE generation strategy. |
||
| 565 | * |
||
| 566 | * The definition has the following structure: |
||
| 567 | * <code> |
||
| 568 | * array( |
||
| 569 | * 'sequenceName' => 'name', |
||
| 570 | * 'allocationSize' => 20, |
||
| 571 | * 'initialValue' => 1 |
||
| 572 | * ) |
||
| 573 | * </code> |
||
| 574 | * |
||
| 575 | * @var array |
||
| 576 | * |
||
| 577 | * @todo Merge with tableGeneratorDefinition into generic generatorDefinition |
||
| 578 | */ |
||
| 579 | public $sequenceGeneratorDefinition; |
||
| 580 | |||
| 581 | /** |
||
| 582 | * READ-ONLY: The definition of the table generator of this class. Only used for the |
||
| 583 | * TABLE generation strategy. |
||
| 584 | * |
||
| 585 | * @var array |
||
| 586 | * |
||
| 587 | * @todo Merge with tableGeneratorDefinition into generic generatorDefinition |
||
| 588 | */ |
||
| 589 | public $tableGeneratorDefinition; |
||
| 590 | |||
| 591 | /** |
||
| 592 | * READ-ONLY: The policy used for change-tracking on entities of this class. |
||
| 593 | * |
||
| 594 | * @var integer |
||
| 595 | */ |
||
| 596 | public $changeTrackingPolicy = self::CHANGETRACKING_DEFERRED_IMPLICIT; |
||
| 597 | |||
| 598 | /** |
||
| 599 | * READ-ONLY: A flag for whether or not instances of this class are to be versioned |
||
| 600 | * with optimistic locking. |
||
| 601 | * |
||
| 602 | * @var boolean |
||
| 603 | */ |
||
| 604 | public $isVersioned; |
||
| 605 | |||
| 606 | /** |
||
| 607 | * READ-ONLY: The name of the field which is used for versioning in optimistic locking (if any). |
||
| 608 | * |
||
| 609 | * @var mixed |
||
| 610 | */ |
||
| 611 | public $versionField; |
||
| 612 | |||
| 613 | /** |
||
| 614 | * @var array |
||
| 615 | */ |
||
| 616 | public $cache = null; |
||
| 617 | |||
| 618 | /** |
||
| 619 | * The ReflectionClass instance of the mapped class. |
||
| 620 | * |
||
| 621 | * @var ReflectionClass |
||
| 622 | */ |
||
| 623 | public $reflClass; |
||
| 624 | |||
| 625 | /** |
||
| 626 | * Is this entity marked as "read-only"? |
||
| 627 | * |
||
| 628 | * That means it is never considered for change-tracking in the UnitOfWork. It is a very helpful performance |
||
| 629 | * optimization for entities that are immutable, either in your domain or through the relation database |
||
| 630 | * (coming from a view, or a history table for example). |
||
| 631 | * |
||
| 632 | * @var bool |
||
| 633 | */ |
||
| 634 | public $isReadOnly = false; |
||
| 635 | |||
| 636 | /** |
||
| 637 | * NamingStrategy determining the default column and table names. |
||
| 638 | * |
||
| 639 | * @var \Doctrine\ORM\Mapping\NamingStrategy |
||
| 640 | */ |
||
| 641 | protected $namingStrategy; |
||
| 642 | |||
| 643 | /** |
||
| 644 | * The ReflectionProperty instances of the mapped class. |
||
| 645 | * |
||
| 646 | * @var \ReflectionProperty[] |
||
| 647 | */ |
||
| 648 | public $reflFields = array(); |
||
| 649 | |||
| 650 | /** |
||
| 651 | * @var \Doctrine\Instantiator\InstantiatorInterface|null |
||
| 652 | */ |
||
| 653 | private $instantiator; |
||
| 654 | |||
| 655 | /** |
||
| 656 | * Initializes a new ClassMetadata instance that will hold the object-relational mapping |
||
| 657 | * metadata of the class with the given name. |
||
| 658 | * |
||
| 659 | * @param string $entityName The name of the entity class the new instance is used for. |
||
| 660 | * @param NamingStrategy|null $namingStrategy |
||
| 661 | */ |
||
| 662 | 646 | public function __construct($entityName, NamingStrategy $namingStrategy = null) |
|
| 669 | |||
| 670 | /** |
||
| 671 | * Gets the ReflectionProperties of the mapped class. |
||
| 672 | * |
||
| 673 | * @return array An array of ReflectionProperty instances. |
||
| 674 | */ |
||
| 675 | 223 | public function getReflectionProperties() |
|
| 679 | |||
| 680 | /** |
||
| 681 | * Gets a ReflectionProperty for a specific field of the mapped class. |
||
| 682 | * |
||
| 683 | * @param string $name |
||
| 684 | * |
||
| 685 | * @return \ReflectionProperty |
||
| 686 | */ |
||
| 687 | 1 | public function getReflectionProperty($name) |
|
| 691 | |||
| 692 | /** |
||
| 693 | * Gets the ReflectionProperty for the single identifier field. |
||
| 694 | * |
||
| 695 | * @return \ReflectionProperty |
||
| 696 | * |
||
| 697 | * @throws BadMethodCallException If the class has a composite identifier. |
||
| 698 | */ |
||
| 699 | public function getSingleIdReflectionProperty() |
||
| 707 | |||
| 708 | /** |
||
| 709 | * Extracts the identifier values of an entity of this class. |
||
| 710 | * |
||
| 711 | * For composite identifiers, the identifier values are returned as an array |
||
| 712 | * with the same order as the field order in {@link identifier}. |
||
| 713 | * |
||
| 714 | * @param object $entity |
||
| 715 | * |
||
| 716 | * @return array |
||
| 717 | */ |
||
| 718 | 463 | public function getIdentifierValues($entity) |
|
| 743 | |||
| 744 | /** |
||
| 745 | * Populates the entity identifier of an entity. |
||
| 746 | * |
||
| 747 | * @param object $entity |
||
| 748 | * @param array $id |
||
| 749 | * |
||
| 750 | * @return void |
||
| 751 | * |
||
| 752 | * @todo Rename to assignIdentifier() |
||
| 753 | */ |
||
| 754 | 6 | public function setIdentifierValues($entity, array $id) |
|
| 760 | |||
| 761 | /** |
||
| 762 | * Sets the specified field to the specified value on the given entity. |
||
| 763 | * |
||
| 764 | * @param object $entity |
||
| 765 | * @param string $field |
||
| 766 | * @param mixed $value |
||
| 767 | * |
||
| 768 | * @return void |
||
| 769 | */ |
||
| 770 | 231 | public function setFieldValue($entity, $field, $value) |
|
| 774 | |||
| 775 | /** |
||
| 776 | * Gets the specified field's value off the given entity. |
||
| 777 | * |
||
| 778 | * @param object $entity |
||
| 779 | * @param string $field |
||
| 780 | * |
||
| 781 | * @return mixed |
||
| 782 | */ |
||
| 783 | 302 | public function getFieldValue($entity, $field) |
|
| 787 | |||
| 788 | /** |
||
| 789 | * Creates a string representation of this instance. |
||
| 790 | * |
||
| 791 | * @return string The string representation of this instance. |
||
| 792 | * |
||
| 793 | * @todo Construct meaningful string representation. |
||
| 794 | */ |
||
| 795 | public function __toString() |
||
| 799 | |||
| 800 | /** |
||
| 801 | * Determines which fields get serialized. |
||
| 802 | * |
||
| 803 | * It is only serialized what is necessary for best unserialization performance. |
||
| 804 | * That means any metadata properties that are not set or empty or simply have |
||
| 805 | * their default value are NOT serialized. |
||
| 806 | * |
||
| 807 | * Parts that are also NOT serialized because they can not be properly unserialized: |
||
| 808 | * - reflClass (ReflectionClass) |
||
| 809 | * - reflFields (ReflectionProperty array) |
||
| 810 | * |
||
| 811 | * @return array The names of all the fields that should be serialized. |
||
| 812 | */ |
||
| 813 | 6 | public function __sleep() |
|
| 907 | |||
| 908 | /** |
||
| 909 | * Creates a new instance of the mapped class, without invoking the constructor. |
||
| 910 | * |
||
| 911 | * @return object |
||
| 912 | */ |
||
| 913 | 670 | public function newInstance() |
|
| 917 | |||
| 918 | /** |
||
| 919 | * Restores some state that can not be serialized/unserialized. |
||
| 920 | * |
||
| 921 | * @param \Doctrine\Common\Persistence\Mapping\ReflectionService $reflService |
||
| 922 | * |
||
| 923 | * @return void |
||
| 924 | */ |
||
| 925 | 2006 | public function wakeupReflection($reflService) |
|
| 972 | |||
| 973 | /** |
||
| 974 | * Initializes a new ClassMetadata instance that will hold the object-relational mapping |
||
| 975 | * metadata of the class with the given name. |
||
| 976 | * |
||
| 977 | * @param \Doctrine\Common\Persistence\Mapping\ReflectionService $reflService The reflection service. |
||
| 978 | * |
||
| 979 | * @return void |
||
| 980 | */ |
||
| 981 | 610 | public function initializeReflection($reflService) |
|
| 992 | |||
| 993 | /** |
||
| 994 | * Validates Identifier. |
||
| 995 | * |
||
| 996 | * @return void |
||
| 997 | * |
||
| 998 | * @throws MappingException |
||
| 999 | */ |
||
| 1000 | 399 | public function validateIdentifier() |
|
| 1015 | |||
| 1016 | /** |
||
| 1017 | * Validates association targets actually exist. |
||
| 1018 | * |
||
| 1019 | * @return void |
||
| 1020 | * |
||
| 1021 | * @throws MappingException |
||
| 1022 | */ |
||
| 1023 | 400 | public function validateAssociations() |
|
| 1031 | |||
| 1032 | /** |
||
| 1033 | * Validates lifecycle callbacks. |
||
| 1034 | * |
||
| 1035 | * @param \Doctrine\Common\Persistence\Mapping\ReflectionService $reflService |
||
| 1036 | * |
||
| 1037 | * @return void |
||
| 1038 | * |
||
| 1039 | * @throws MappingException |
||
| 1040 | */ |
||
| 1041 | 400 | public function validateLifecycleCallbacks($reflService) |
|
| 1051 | |||
| 1052 | /** |
||
| 1053 | * {@inheritDoc} |
||
| 1054 | */ |
||
| 1055 | 527 | public function getReflectionClass() |
|
| 1059 | |||
| 1060 | /** |
||
| 1061 | * @param array $cache |
||
| 1062 | * |
||
| 1063 | * @return void |
||
| 1064 | */ |
||
| 1065 | 20 | public function enableCache(array $cache) |
|
| 1077 | |||
| 1078 | /** |
||
| 1079 | * @param string $fieldName |
||
| 1080 | * @param array $cache |
||
| 1081 | * |
||
| 1082 | * @return void |
||
| 1083 | */ |
||
| 1084 | 2 | public function enableAssociationCache($fieldName, array $cache) |
|
| 1088 | |||
| 1089 | /** |
||
| 1090 | * @param string $fieldName |
||
| 1091 | * @param array $cache |
||
| 1092 | * |
||
| 1093 | * @return array |
||
| 1094 | */ |
||
| 1095 | 16 | public function getAssociationCacheDefaults($fieldName, array $cache) |
|
| 1109 | |||
| 1110 | /** |
||
| 1111 | * Sets the change tracking policy used by this class. |
||
| 1112 | * |
||
| 1113 | * @param integer $policy |
||
| 1114 | * |
||
| 1115 | * @return void |
||
| 1116 | */ |
||
| 1117 | 138 | public function setChangeTrackingPolicy($policy) |
|
| 1121 | |||
| 1122 | /** |
||
| 1123 | * Whether the change tracking policy of this class is "deferred explicit". |
||
| 1124 | * |
||
| 1125 | * @return boolean |
||
| 1126 | */ |
||
| 1127 | 267 | public function isChangeTrackingDeferredExplicit() |
|
| 1131 | |||
| 1132 | /** |
||
| 1133 | * Whether the change tracking policy of this class is "deferred implicit". |
||
| 1134 | * |
||
| 1135 | * @return boolean |
||
| 1136 | */ |
||
| 1137 | 458 | public function isChangeTrackingDeferredImplicit() |
|
| 1141 | |||
| 1142 | /** |
||
| 1143 | * Whether the change tracking policy of this class is "notify". |
||
| 1144 | * |
||
| 1145 | * @return boolean |
||
| 1146 | */ |
||
| 1147 | 290 | public function isChangeTrackingNotify() |
|
| 1151 | |||
| 1152 | /** |
||
| 1153 | * Checks whether a field is part of the identifier/primary key field(s). |
||
| 1154 | * |
||
| 1155 | * @param string $fieldName The field name. |
||
| 1156 | * |
||
| 1157 | * @return boolean TRUE if the field is part of the table identifier/primary key field(s), |
||
| 1158 | * FALSE otherwise. |
||
| 1159 | */ |
||
| 1160 | 1069 | public function isIdentifier($fieldName) |
|
| 1172 | |||
| 1173 | /** |
||
| 1174 | * Checks if the field is unique. |
||
| 1175 | * |
||
| 1176 | * @param string $fieldName The field name. |
||
| 1177 | * |
||
| 1178 | * @return boolean TRUE if the field is unique, FALSE otherwise. |
||
| 1179 | */ |
||
| 1180 | public function isUniqueField($fieldName) |
||
| 1190 | |||
| 1191 | /** |
||
| 1192 | * Checks if the field is not null. |
||
| 1193 | * |
||
| 1194 | * @param string $fieldName The field name. |
||
| 1195 | * |
||
| 1196 | * @return boolean TRUE if the field is not null, FALSE otherwise. |
||
| 1197 | */ |
||
| 1198 | 1 | public function isNullable($fieldName) |
|
| 1208 | |||
| 1209 | /** |
||
| 1210 | * Checks if the field is readOnly. |
||
| 1211 | * |
||
| 1212 | * @param string $fieldName The field name. |
||
| 1213 | * |
||
| 1214 | * @return boolean TRUE if the field is readOnly, FALSE otherwise. |
||
| 1215 | */ |
||
| 1216 | 1001 | public function isReadOnly($fieldName) |
|
| 1226 | |||
| 1227 | /** |
||
| 1228 | * Gets a column name for a field name. |
||
| 1229 | * If the column name for the field cannot be found, the given field name |
||
| 1230 | * is returned. |
||
| 1231 | * |
||
| 1232 | * @param string $fieldName The field name. |
||
| 1233 | * |
||
| 1234 | * @return string The column name. |
||
| 1235 | */ |
||
| 1236 | 16 | public function getColumnName($fieldName) |
|
| 1242 | |||
| 1243 | /** |
||
| 1244 | * Gets the mapping of a (regular) field that holds some data but not a |
||
| 1245 | * reference to another object. |
||
| 1246 | * |
||
| 1247 | * @param string $fieldName The field name. |
||
| 1248 | * |
||
| 1249 | * @return array The field mapping. |
||
| 1250 | * |
||
| 1251 | * @throws MappingException |
||
| 1252 | */ |
||
| 1253 | 1034 | public function getFieldMapping($fieldName) |
|
| 1261 | |||
| 1262 | /** |
||
| 1263 | * Gets the mapping of an association. |
||
| 1264 | * |
||
| 1265 | * @see ClassMetadataInfo::$associationMappings |
||
| 1266 | * |
||
| 1267 | * @param string $fieldName The field name that represents the association in |
||
| 1268 | * the object model. |
||
| 1269 | * |
||
| 1270 | * @return array The mapping. |
||
| 1271 | * |
||
| 1272 | * @throws MappingException |
||
| 1273 | */ |
||
| 1274 | 484 | public function getAssociationMapping($fieldName) |
|
| 1282 | |||
| 1283 | /** |
||
| 1284 | * Gets all association mappings of the class. |
||
| 1285 | * |
||
| 1286 | * @return array |
||
| 1287 | */ |
||
| 1288 | public function getAssociationMappings() |
||
| 1292 | |||
| 1293 | /** |
||
| 1294 | * Gets the field name for a column name. |
||
| 1295 | * If no field name can be found the column name is returned. |
||
| 1296 | * |
||
| 1297 | * @param string $columnName The column name. |
||
| 1298 | * |
||
| 1299 | * @return string The column alias. |
||
| 1300 | */ |
||
| 1301 | 236 | public function getFieldName($columnName) |
|
| 1307 | |||
| 1308 | /** |
||
| 1309 | * Gets the named query. |
||
| 1310 | * |
||
| 1311 | * @see ClassMetadataInfo::$namedQueries |
||
| 1312 | * |
||
| 1313 | * @param string $queryName The query name. |
||
| 1314 | * |
||
| 1315 | * @return string |
||
| 1316 | * |
||
| 1317 | * @throws MappingException |
||
| 1318 | */ |
||
| 1319 | 4 | public function getNamedQuery($queryName) |
|
| 1327 | |||
| 1328 | /** |
||
| 1329 | * Gets all named queries of the class. |
||
| 1330 | * |
||
| 1331 | * @return array |
||
| 1332 | */ |
||
| 1333 | 7 | public function getNamedQueries() |
|
| 1337 | |||
| 1338 | /** |
||
| 1339 | * Gets the named native query. |
||
| 1340 | * |
||
| 1341 | * @see ClassMetadataInfo::$namedNativeQueries |
||
| 1342 | * |
||
| 1343 | * @param string $queryName The query name. |
||
| 1344 | * |
||
| 1345 | * @return array |
||
| 1346 | * |
||
| 1347 | * @throws MappingException |
||
| 1348 | */ |
||
| 1349 | 17 | public function getNamedNativeQuery($queryName) |
|
| 1357 | |||
| 1358 | /** |
||
| 1359 | * Gets all named native queries of the class. |
||
| 1360 | * |
||
| 1361 | * @return array |
||
| 1362 | */ |
||
| 1363 | 2 | public function getNamedNativeQueries() |
|
| 1367 | |||
| 1368 | /** |
||
| 1369 | * Gets the result set mapping. |
||
| 1370 | * |
||
| 1371 | * @see ClassMetadataInfo::$sqlResultSetMappings |
||
| 1372 | * |
||
| 1373 | * @param string $name The result set mapping name. |
||
| 1374 | * |
||
| 1375 | * @return array |
||
| 1376 | * |
||
| 1377 | * @throws MappingException |
||
| 1378 | */ |
||
| 1379 | 21 | public function getSqlResultSetMapping($name) |
|
| 1387 | |||
| 1388 | /** |
||
| 1389 | * Gets all sql result set mappings of the class. |
||
| 1390 | * |
||
| 1391 | * @return array |
||
| 1392 | */ |
||
| 1393 | 8 | public function getSqlResultSetMappings() |
|
| 1397 | |||
| 1398 | /** |
||
| 1399 | * Validates & completes the given field mapping. |
||
| 1400 | * |
||
| 1401 | * @param array $mapping The field mapping to validate & complete. |
||
| 1402 | * |
||
| 1403 | * @return array The validated and completed field mapping. |
||
| 1404 | * |
||
| 1405 | * @throws MappingException |
||
| 1406 | */ |
||
| 1407 | 527 | protected function _validateAndCompleteFieldMapping(array &$mapping) |
|
| 1461 | |||
| 1462 | /** |
||
| 1463 | * Validates & completes the basic mapping information that is common to all |
||
| 1464 | * association mappings (one-to-one, many-ot-one, one-to-many, many-to-many). |
||
| 1465 | * |
||
| 1466 | * @param array $mapping The mapping. |
||
| 1467 | * |
||
| 1468 | * @return array The updated mapping. |
||
| 1469 | * |
||
| 1470 | * @throws MappingException If something is wrong with the mapping. |
||
| 1471 | */ |
||
| 1472 | 349 | protected function _validateAndCompleteAssociationMapping(array $mapping) |
|
| 1584 | |||
| 1585 | /** |
||
| 1586 | * Validates & completes a one-to-one association mapping. |
||
| 1587 | * |
||
| 1588 | * @param array $mapping The mapping to validate & complete. |
||
| 1589 | * |
||
| 1590 | * @return array The validated & completed mapping. |
||
| 1591 | * |
||
| 1592 | * @throws RuntimeException |
||
| 1593 | * @throws MappingException |
||
| 1594 | */ |
||
| 1595 | 296 | protected function _validateAndCompleteOneToOneMapping(array $mapping) |
|
| 1677 | |||
| 1678 | /** |
||
| 1679 | * Validates & completes a one-to-many association mapping. |
||
| 1680 | * |
||
| 1681 | * @param array $mapping The mapping to validate and complete. |
||
| 1682 | * |
||
| 1683 | * @return array The validated and completed mapping. |
||
| 1684 | * |
||
| 1685 | * @throws MappingException |
||
| 1686 | * @throws InvalidArgumentException |
||
| 1687 | */ |
||
| 1688 | 128 | protected function _validateAndCompleteOneToManyMapping(array $mapping) |
|
| 1708 | |||
| 1709 | /** |
||
| 1710 | * Validates & completes a many-to-many association mapping. |
||
| 1711 | * |
||
| 1712 | * @param array $mapping The mapping to validate & complete. |
||
| 1713 | * |
||
| 1714 | * @return array The validated & completed mapping. |
||
| 1715 | * |
||
| 1716 | * @throws \InvalidArgumentException |
||
| 1717 | */ |
||
| 1718 | 149 | protected function _validateAndCompleteManyToManyMapping(array $mapping) |
|
| 1818 | |||
| 1819 | /** |
||
| 1820 | * {@inheritDoc} |
||
| 1821 | */ |
||
| 1822 | 593 | public function getIdentifierFieldNames() |
|
| 1826 | |||
| 1827 | /** |
||
| 1828 | * Gets the name of the single id field. Note that this only works on |
||
| 1829 | * entity classes that have a single-field pk. |
||
| 1830 | * |
||
| 1831 | * @return string |
||
| 1832 | * |
||
| 1833 | * @throws MappingException If the class has a composite primary key. |
||
| 1834 | */ |
||
| 1835 | 397 | public function getSingleIdentifierFieldName() |
|
| 1843 | |||
| 1844 | /** |
||
| 1845 | * Gets the column name of the single id column. Note that this only works on |
||
| 1846 | * entity classes that have a single-field pk. |
||
| 1847 | * |
||
| 1848 | * @return string |
||
| 1849 | * |
||
| 1850 | * @throws MappingException If the class has a composite primary key. |
||
| 1851 | */ |
||
| 1852 | 3 | public function getSingleIdentifierColumnName() |
|
| 1856 | |||
| 1857 | /** |
||
| 1858 | * INTERNAL: |
||
| 1859 | * Sets the mapped identifier/primary key fields of this class. |
||
| 1860 | * Mainly used by the ClassMetadataFactory to assign inherited identifiers. |
||
| 1861 | * |
||
| 1862 | * @param array $identifier |
||
| 1863 | * |
||
| 1864 | * @return void |
||
| 1865 | */ |
||
| 1866 | 123 | public function setIdentifier(array $identifier) |
|
| 1871 | |||
| 1872 | /** |
||
| 1873 | * {@inheritDoc} |
||
| 1874 | */ |
||
| 1875 | 61 | public function getIdentifier() |
|
| 1879 | |||
| 1880 | /** |
||
| 1881 | * {@inheritDoc} |
||
| 1882 | */ |
||
| 1883 | 1080 | public function hasField($fieldName) |
|
| 1887 | |||
| 1888 | /** |
||
| 1889 | * Gets an array containing all the column names. |
||
| 1890 | * |
||
| 1891 | * @param array|null $fieldNames |
||
| 1892 | * |
||
| 1893 | * @return array |
||
| 1894 | */ |
||
| 1895 | 42 | public function getColumnNames(array $fieldNames = null) |
|
| 1903 | |||
| 1904 | /** |
||
| 1905 | * Returns an array with all the identifier column names. |
||
| 1906 | * |
||
| 1907 | * @return array |
||
| 1908 | */ |
||
| 1909 | 322 | public function getIdentifierColumnNames() |
|
| 1929 | |||
| 1930 | /** |
||
| 1931 | * Sets the type of Id generator to use for the mapped class. |
||
| 1932 | * |
||
| 1933 | * @param int $generatorType |
||
| 1934 | * |
||
| 1935 | * @return void |
||
| 1936 | */ |
||
| 1937 | 456 | public function setIdGeneratorType($generatorType) |
|
| 1941 | |||
| 1942 | /** |
||
| 1943 | * Checks whether the mapped class uses an Id generator. |
||
| 1944 | * |
||
| 1945 | * @return boolean TRUE if the mapped class uses an Id generator, FALSE otherwise. |
||
| 1946 | */ |
||
| 1947 | 391 | public function usesIdGenerator() |
|
| 1951 | |||
| 1952 | /** |
||
| 1953 | * @return boolean |
||
| 1954 | */ |
||
| 1955 | 1323 | public function isInheritanceTypeNone() |
|
| 1959 | |||
| 1960 | /** |
||
| 1961 | * Checks whether the mapped class uses the JOINED inheritance mapping strategy. |
||
| 1962 | * |
||
| 1963 | * @return boolean TRUE if the class participates in a JOINED inheritance mapping, |
||
| 1964 | * FALSE otherwise. |
||
| 1965 | */ |
||
| 1966 | 1049 | public function isInheritanceTypeJoined() |
|
| 1970 | |||
| 1971 | /** |
||
| 1972 | * Checks whether the mapped class uses the SINGLE_TABLE inheritance mapping strategy. |
||
| 1973 | * |
||
| 1974 | * @return boolean TRUE if the class participates in a SINGLE_TABLE inheritance mapping, |
||
| 1975 | * FALSE otherwise. |
||
| 1976 | */ |
||
| 1977 | 1221 | public function isInheritanceTypeSingleTable() |
|
| 1981 | |||
| 1982 | /** |
||
| 1983 | * Checks whether the mapped class uses the TABLE_PER_CLASS inheritance mapping strategy. |
||
| 1984 | * |
||
| 1985 | * @return boolean TRUE if the class participates in a TABLE_PER_CLASS inheritance mapping, |
||
| 1986 | * FALSE otherwise. |
||
| 1987 | */ |
||
| 1988 | 259 | public function isInheritanceTypeTablePerClass() |
|
| 1992 | |||
| 1993 | /** |
||
| 1994 | * Checks whether the class uses an identity column for the Id generation. |
||
| 1995 | * |
||
| 1996 | * @return boolean TRUE if the class uses the IDENTITY generator, FALSE otherwise. |
||
| 1997 | */ |
||
| 1998 | 1062 | public function isIdGeneratorIdentity() |
|
| 2002 | |||
| 2003 | /** |
||
| 2004 | * Checks whether the class uses a sequence for id generation. |
||
| 2005 | * |
||
| 2006 | * @return boolean TRUE if the class uses the SEQUENCE generator, FALSE otherwise. |
||
| 2007 | */ |
||
| 2008 | 312 | public function isIdGeneratorSequence() |
|
| 2012 | |||
| 2013 | /** |
||
| 2014 | * Checks whether the class uses a table for id generation. |
||
| 2015 | * |
||
| 2016 | * @return boolean TRUE if the class uses the TABLE generator, FALSE otherwise. |
||
| 2017 | */ |
||
| 2018 | 80 | public function isIdGeneratorTable() |
|
| 2022 | |||
| 2023 | /** |
||
| 2024 | * Checks whether the class has a natural identifier/pk (which means it does |
||
| 2025 | * not use any Id generator. |
||
| 2026 | * |
||
| 2027 | * @return boolean |
||
| 2028 | */ |
||
| 2029 | 73 | public function isIdentifierNatural() |
|
| 2033 | |||
| 2034 | /** |
||
| 2035 | * Checks whether the class use a UUID for id generation. |
||
| 2036 | * |
||
| 2037 | * @return boolean |
||
| 2038 | */ |
||
| 2039 | public function isIdentifierUuid() |
||
| 2043 | |||
| 2044 | /** |
||
| 2045 | * Gets the type of a field. |
||
| 2046 | * |
||
| 2047 | * @param string $fieldName |
||
| 2048 | * |
||
| 2049 | * @return \Doctrine\DBAL\Types\Type|string|null |
||
| 2050 | * |
||
| 2051 | * @todo 3.0 Remove this. PersisterHelper should fix it somehow |
||
| 2052 | */ |
||
| 2053 | 38 | public function getTypeOfField($fieldName) |
|
| 2059 | |||
| 2060 | /** |
||
| 2061 | * Gets the type of a column. |
||
| 2062 | * |
||
| 2063 | * @param string $columnName |
||
| 2064 | * |
||
| 2065 | * @return \Doctrine\DBAL\Types\Type|string|null |
||
| 2066 | * |
||
| 2067 | * @deprecated 3.0 remove this. this method is bogous and unreliable, since it cannot resolve the type of a column |
||
| 2068 | * that is derived by a referenced field on a different entity. |
||
| 2069 | */ |
||
| 2070 | public function getTypeOfColumn($columnName) |
||
| 2074 | |||
| 2075 | /** |
||
| 2076 | * Gets the name of the primary table. |
||
| 2077 | * |
||
| 2078 | * @return string |
||
| 2079 | */ |
||
| 2080 | 1464 | public function getTableName() |
|
| 2084 | |||
| 2085 | /** |
||
| 2086 | * Gets primary table's schema name. |
||
| 2087 | * |
||
| 2088 | * @return string|null |
||
| 2089 | */ |
||
| 2090 | 13 | public function getSchemaName() |
|
| 2094 | |||
| 2095 | /** |
||
| 2096 | * Gets the table name to use for temporary identifier tables of this class. |
||
| 2097 | * |
||
| 2098 | * @return string |
||
| 2099 | */ |
||
| 2100 | 7 | public function getTemporaryIdTableName() |
|
| 2105 | |||
| 2106 | /** |
||
| 2107 | * Sets the mapped subclasses of this class. |
||
| 2108 | * |
||
| 2109 | * @param array $subclasses The names of all mapped subclasses. |
||
| 2110 | * |
||
| 2111 | * @return void |
||
| 2112 | */ |
||
| 2113 | 2 | public function setSubclasses(array $subclasses) |
|
| 2119 | |||
| 2120 | /** |
||
| 2121 | * Sets the parent class names. |
||
| 2122 | * Assumes that the class names in the passed array are in the order: |
||
| 2123 | * directParent -> directParentParent -> directParentParentParent ... -> root. |
||
| 2124 | * |
||
| 2125 | * @param array $classNames |
||
| 2126 | * |
||
| 2127 | * @return void |
||
| 2128 | */ |
||
| 2129 | 408 | public function setParentClasses(array $classNames) |
|
| 2137 | |||
| 2138 | /** |
||
| 2139 | * Sets the inheritance type used by the class and its subclasses. |
||
| 2140 | * |
||
| 2141 | * @param integer $type |
||
| 2142 | * |
||
| 2143 | * @return void |
||
| 2144 | * |
||
| 2145 | * @throws MappingException |
||
| 2146 | */ |
||
| 2147 | 169 | public function setInheritanceType($type) |
|
| 2155 | |||
| 2156 | /** |
||
| 2157 | * Sets the association to override association mapping of property for an entity relationship. |
||
| 2158 | * |
||
| 2159 | * @param string $fieldName |
||
| 2160 | * @param array $overrideMapping |
||
| 2161 | * |
||
| 2162 | * @return void |
||
| 2163 | * |
||
| 2164 | * @throws MappingException |
||
| 2165 | */ |
||
| 2166 | 20 | public function setAssociationOverride($fieldName, array $overrideMapping) |
|
| 2209 | |||
| 2210 | /** |
||
| 2211 | * Sets the override for a mapped field. |
||
| 2212 | * |
||
| 2213 | * @param string $fieldName |
||
| 2214 | * @param array $overrideMapping |
||
| 2215 | * |
||
| 2216 | * @return void |
||
| 2217 | * |
||
| 2218 | * @throws MappingException |
||
| 2219 | */ |
||
| 2220 | 15 | public function setAttributeOverride($fieldName, array $overrideMapping) |
|
| 2252 | |||
| 2253 | /** |
||
| 2254 | * Checks whether a mapped field is inherited from an entity superclass. |
||
| 2255 | * |
||
| 2256 | * @param string $fieldName |
||
| 2257 | * |
||
| 2258 | * @return bool TRUE if the field is inherited, FALSE otherwise. |
||
| 2259 | */ |
||
| 2260 | 368 | public function isInheritedField($fieldName) |
|
| 2264 | |||
| 2265 | /** |
||
| 2266 | * Checks if this entity is the root in any entity-inheritance-hierarchy. |
||
| 2267 | * |
||
| 2268 | * @return bool |
||
| 2269 | */ |
||
| 2270 | 407 | public function isRootEntity() |
|
| 2274 | |||
| 2275 | /** |
||
| 2276 | * Checks whether a mapped association field is inherited from a superclass. |
||
| 2277 | * |
||
| 2278 | * @param string $fieldName |
||
| 2279 | * |
||
| 2280 | * @return boolean TRUE if the field is inherited, FALSE otherwise. |
||
| 2281 | */ |
||
| 2282 | 347 | public function isInheritedAssociation($fieldName) |
|
| 2286 | |||
| 2287 | 347 | public function isInheritedEmbeddedClass($fieldName) |
|
| 2291 | |||
| 2292 | /** |
||
| 2293 | * Sets the name of the primary table the class is mapped to. |
||
| 2294 | * |
||
| 2295 | * @param string $tableName The table name. |
||
| 2296 | * |
||
| 2297 | * @return void |
||
| 2298 | * |
||
| 2299 | * @deprecated Use {@link setPrimaryTable}. |
||
| 2300 | */ |
||
| 2301 | public function setTableName($tableName) |
||
| 2305 | |||
| 2306 | /** |
||
| 2307 | * Sets the primary table definition. The provided array supports the |
||
| 2308 | * following structure: |
||
| 2309 | * |
||
| 2310 | * name => <tableName> (optional, defaults to class name) |
||
| 2311 | * indexes => array of indexes (optional) |
||
| 2312 | * uniqueConstraints => array of constraints (optional) |
||
| 2313 | * |
||
| 2314 | * If a key is omitted, the current value is kept. |
||
| 2315 | * |
||
| 2316 | * @param array $table The table description. |
||
| 2317 | * |
||
| 2318 | * @return void |
||
| 2319 | */ |
||
| 2320 | 323 | public function setPrimaryTable(array $table) |
|
| 2352 | |||
| 2353 | /** |
||
| 2354 | * Checks whether the given type identifies an inheritance type. |
||
| 2355 | * |
||
| 2356 | * @param integer $type |
||
| 2357 | * |
||
| 2358 | * @return boolean TRUE if the given type identifies an inheritance type, FALSe otherwise. |
||
| 2359 | */ |
||
| 2360 | 169 | private function _isInheritanceType($type) |
|
| 2367 | |||
| 2368 | /** |
||
| 2369 | * Adds a mapped field to the class. |
||
| 2370 | * |
||
| 2371 | * @param array $mapping The field mapping. |
||
| 2372 | * |
||
| 2373 | * @return void |
||
| 2374 | * |
||
| 2375 | * @throws MappingException |
||
| 2376 | */ |
||
| 2377 | 527 | public function mapField(array $mapping) |
|
| 2384 | |||
| 2385 | /** |
||
| 2386 | * INTERNAL: |
||
| 2387 | * Adds an association mapping without completing/validating it. |
||
| 2388 | * This is mainly used to add inherited association mappings to derived classes. |
||
| 2389 | * |
||
| 2390 | * @param array $mapping |
||
| 2391 | * |
||
| 2392 | * @return void |
||
| 2393 | * |
||
| 2394 | * @throws MappingException |
||
| 2395 | */ |
||
| 2396 | 48 | public function addInheritedAssociationMapping(array $mapping/*, $owningClassName = null*/) |
|
| 2403 | |||
| 2404 | /** |
||
| 2405 | * INTERNAL: |
||
| 2406 | * Adds a field mapping without completing/validating it. |
||
| 2407 | * This is mainly used to add inherited field mappings to derived classes. |
||
| 2408 | * |
||
| 2409 | * @param array $fieldMapping |
||
| 2410 | * |
||
| 2411 | * @return void |
||
| 2412 | */ |
||
| 2413 | 107 | public function addInheritedFieldMapping(array $fieldMapping) |
|
| 2419 | |||
| 2420 | /** |
||
| 2421 | * INTERNAL: |
||
| 2422 | * Adds a named query to this class. |
||
| 2423 | * |
||
| 2424 | * @param array $queryMapping |
||
| 2425 | * |
||
| 2426 | * @return void |
||
| 2427 | * |
||
| 2428 | * @throws MappingException |
||
| 2429 | */ |
||
| 2430 | 29 | public function addNamedQuery(array $queryMapping) |
|
| 2454 | |||
| 2455 | /** |
||
| 2456 | * INTERNAL: |
||
| 2457 | * Adds a named native query to this class. |
||
| 2458 | * |
||
| 2459 | * @param array $queryMapping |
||
| 2460 | * |
||
| 2461 | * @return void |
||
| 2462 | * |
||
| 2463 | * @throws MappingException |
||
| 2464 | */ |
||
| 2465 | 39 | public function addNamedNativeQuery(array $queryMapping) |
|
| 2498 | |||
| 2499 | /** |
||
| 2500 | * INTERNAL: |
||
| 2501 | * Adds a sql result set mapping to this class. |
||
| 2502 | * |
||
| 2503 | * @param array $resultMapping |
||
| 2504 | * |
||
| 2505 | * @return void |
||
| 2506 | * |
||
| 2507 | * @throws MappingException |
||
| 2508 | */ |
||
| 2509 | 39 | public function addSqlResultSetMapping(array $resultMapping) |
|
| 2559 | |||
| 2560 | /** |
||
| 2561 | * Adds a one-to-one mapping. |
||
| 2562 | * |
||
| 2563 | * @param array $mapping The mapping. |
||
| 2564 | * |
||
| 2565 | * @return void |
||
| 2566 | */ |
||
| 2567 | 167 | public function mapOneToOne(array $mapping) |
|
| 2575 | |||
| 2576 | /** |
||
| 2577 | * Adds a one-to-many mapping. |
||
| 2578 | * |
||
| 2579 | * @param array $mapping The mapping. |
||
| 2580 | * |
||
| 2581 | * @return void |
||
| 2582 | */ |
||
| 2583 | 128 | public function mapOneToMany(array $mapping) |
|
| 2591 | |||
| 2592 | /** |
||
| 2593 | * Adds a many-to-one mapping. |
||
| 2594 | * |
||
| 2595 | * @param array $mapping The mapping. |
||
| 2596 | * |
||
| 2597 | * @return void |
||
| 2598 | */ |
||
| 2599 | 161 | public function mapManyToOne(array $mapping) |
|
| 2608 | |||
| 2609 | /** |
||
| 2610 | * Adds a many-to-many mapping. |
||
| 2611 | * |
||
| 2612 | * @param array $mapping The mapping. |
||
| 2613 | * |
||
| 2614 | * @return void |
||
| 2615 | */ |
||
| 2616 | 149 | public function mapManyToMany(array $mapping) |
|
| 2624 | |||
| 2625 | /** |
||
| 2626 | * Stores the association mapping. |
||
| 2627 | * |
||
| 2628 | * @param array $assocMapping |
||
| 2629 | * |
||
| 2630 | * @return void |
||
| 2631 | * |
||
| 2632 | * @throws MappingException |
||
| 2633 | */ |
||
| 2634 | 338 | protected function _storeAssociationMapping(array $assocMapping) |
|
| 2642 | |||
| 2643 | /** |
||
| 2644 | * Registers a custom repository class for the entity class. |
||
| 2645 | * |
||
| 2646 | * @param string $repositoryClassName The class name of the custom mapper. |
||
| 2647 | * |
||
| 2648 | * @return void |
||
| 2649 | */ |
||
| 2650 | 62 | public function setCustomRepositoryClass($repositoryClassName) |
|
| 2654 | |||
| 2655 | /** |
||
| 2656 | * Dispatches the lifecycle event of the given entity to the registered |
||
| 2657 | * lifecycle callbacks and lifecycle listeners. |
||
| 2658 | * |
||
| 2659 | * @deprecated Deprecated since version 2.4 in favor of \Doctrine\ORM\Event\ListenersInvoker |
||
| 2660 | * |
||
| 2661 | * @param string $lifecycleEvent The lifecycle event. |
||
| 2662 | * @param object $entity The Entity on which the event occurred. |
||
| 2663 | * |
||
| 2664 | * @return void |
||
| 2665 | */ |
||
| 2666 | public function invokeLifecycleCallbacks($lifecycleEvent, $entity) |
||
| 2672 | |||
| 2673 | /** |
||
| 2674 | * Whether the class has any attached lifecycle listeners or callbacks for a lifecycle event. |
||
| 2675 | * |
||
| 2676 | * @param string $lifecycleEvent |
||
| 2677 | * |
||
| 2678 | * @return boolean |
||
| 2679 | */ |
||
| 2680 | public function hasLifecycleCallbacks($lifecycleEvent) |
||
| 2684 | |||
| 2685 | /** |
||
| 2686 | * Gets the registered lifecycle callbacks for an event. |
||
| 2687 | * |
||
| 2688 | * @param string $event |
||
| 2689 | * |
||
| 2690 | * @return array |
||
| 2691 | */ |
||
| 2692 | public function getLifecycleCallbacks($event) |
||
| 2696 | |||
| 2697 | /** |
||
| 2698 | * Adds a lifecycle callback for entities of this class. |
||
| 2699 | * |
||
| 2700 | * @param string $callback |
||
| 2701 | * @param string $event |
||
| 2702 | * |
||
| 2703 | * @return void |
||
| 2704 | */ |
||
| 2705 | 41 | public function addLifecycleCallback($callback, $event) |
|
| 2713 | |||
| 2714 | /** |
||
| 2715 | * Sets the lifecycle callbacks for entities of this class. |
||
| 2716 | * Any previously registered callbacks are overwritten. |
||
| 2717 | * |
||
| 2718 | * @param array $callbacks |
||
| 2719 | * |
||
| 2720 | * @return void |
||
| 2721 | */ |
||
| 2722 | 122 | public function setLifecycleCallbacks(array $callbacks) |
|
| 2726 | |||
| 2727 | /** |
||
| 2728 | * Adds a entity listener for entities of this class. |
||
| 2729 | * |
||
| 2730 | * @param string $eventName The entity lifecycle event. |
||
| 2731 | * @param string $class The listener class. |
||
| 2732 | * @param string $method The listener callback method. |
||
| 2733 | * |
||
| 2734 | * @throws \Doctrine\ORM\Mapping\MappingException |
||
| 2735 | */ |
||
| 2736 | 35 | public function addEntityListener($eventName, $class, $method) |
|
| 2759 | |||
| 2760 | /** |
||
| 2761 | * Sets the discriminator column definition. |
||
| 2762 | * |
||
| 2763 | * @param array $columnDef |
||
| 2764 | * |
||
| 2765 | * @return void |
||
| 2766 | * |
||
| 2767 | * @throws MappingException |
||
| 2768 | * |
||
| 2769 | * @see getDiscriminatorColumn() |
||
| 2770 | */ |
||
| 2771 | 163 | public function setDiscriminatorColumn($columnDef) |
|
| 2797 | |||
| 2798 | /** |
||
| 2799 | * Sets the discriminator values used by this class. |
||
| 2800 | * Used for JOINED and SINGLE_TABLE inheritance mapping strategies. |
||
| 2801 | * |
||
| 2802 | * @param array $map |
||
| 2803 | * |
||
| 2804 | * @return void |
||
| 2805 | */ |
||
| 2806 | 156 | public function setDiscriminatorMap(array $map) |
|
| 2812 | |||
| 2813 | /** |
||
| 2814 | * Adds one entry of the discriminator map with a new class and corresponding name. |
||
| 2815 | * |
||
| 2816 | * @param string $name |
||
| 2817 | * @param string $className |
||
| 2818 | * |
||
| 2819 | * @return void |
||
| 2820 | * |
||
| 2821 | * @throws MappingException |
||
| 2822 | */ |
||
| 2823 | 104 | public function addDiscriminatorMapClass($name, $className) |
|
| 2844 | |||
| 2845 | /** |
||
| 2846 | * Checks whether the class has a named query with the given query name. |
||
| 2847 | * |
||
| 2848 | * @param string $queryName |
||
| 2849 | * |
||
| 2850 | * @return boolean |
||
| 2851 | */ |
||
| 2852 | 1 | public function hasNamedQuery($queryName) |
|
| 2856 | |||
| 2857 | /** |
||
| 2858 | * Checks whether the class has a named native query with the given query name. |
||
| 2859 | * |
||
| 2860 | * @param string $queryName |
||
| 2861 | * |
||
| 2862 | * @return boolean |
||
| 2863 | */ |
||
| 2864 | 1 | public function hasNamedNativeQuery($queryName) |
|
| 2868 | |||
| 2869 | /** |
||
| 2870 | * Checks whether the class has a named native query with the given query name. |
||
| 2871 | * |
||
| 2872 | * @param string $name |
||
| 2873 | * |
||
| 2874 | * @return boolean |
||
| 2875 | */ |
||
| 2876 | 1 | public function hasSqlResultSetMapping($name) |
|
| 2880 | |||
| 2881 | /** |
||
| 2882 | * {@inheritDoc} |
||
| 2883 | */ |
||
| 2884 | 341 | public function hasAssociation($fieldName) |
|
| 2888 | |||
| 2889 | /** |
||
| 2890 | * {@inheritDoc} |
||
| 2891 | */ |
||
| 2892 | 1 | public function isSingleValuedAssociation($fieldName) |
|
| 2897 | |||
| 2898 | /** |
||
| 2899 | * {@inheritDoc} |
||
| 2900 | */ |
||
| 2901 | 1025 | public function isCollectionValuedAssociation($fieldName) |
|
| 2906 | |||
| 2907 | /** |
||
| 2908 | * Is this an association that only has a single join column? |
||
| 2909 | * |
||
| 2910 | * @param string $fieldName |
||
| 2911 | * |
||
| 2912 | * @return bool |
||
| 2913 | */ |
||
| 2914 | 35 | public function isAssociationWithSingleJoinColumn($fieldName) |
|
| 2920 | |||
| 2921 | /** |
||
| 2922 | * Returns the single association join column (if any). |
||
| 2923 | * |
||
| 2924 | * @param string $fieldName |
||
| 2925 | * |
||
| 2926 | * @return string |
||
| 2927 | * |
||
| 2928 | * @throws MappingException |
||
| 2929 | */ |
||
| 2930 | 9 | public function getSingleAssociationJoinColumnName($fieldName) |
|
| 2938 | |||
| 2939 | /** |
||
| 2940 | * Returns the single association referenced join column name (if any). |
||
| 2941 | * |
||
| 2942 | * @param string $fieldName |
||
| 2943 | * |
||
| 2944 | * @return string |
||
| 2945 | * |
||
| 2946 | * @throws MappingException |
||
| 2947 | */ |
||
| 2948 | 9 | public function getSingleAssociationReferencedJoinColumnName($fieldName) |
|
| 2956 | |||
| 2957 | /** |
||
| 2958 | * Used to retrieve a fieldname for either field or association from a given column. |
||
| 2959 | * |
||
| 2960 | * This method is used in foreign-key as primary-key contexts. |
||
| 2961 | * |
||
| 2962 | * @param string $columnName |
||
| 2963 | * |
||
| 2964 | * @return string |
||
| 2965 | * |
||
| 2966 | * @throws MappingException |
||
| 2967 | */ |
||
| 2968 | 633 | public function getFieldForColumn($columnName) |
|
| 2984 | |||
| 2985 | /** |
||
| 2986 | * Sets the ID generator used to generate IDs for instances of this class. |
||
| 2987 | * |
||
| 2988 | * @param \Doctrine\ORM\Id\AbstractIdGenerator $generator |
||
| 2989 | * |
||
| 2990 | * @return void |
||
| 2991 | */ |
||
| 2992 | 410 | public function setIdGenerator($generator) |
|
| 2996 | |||
| 2997 | /** |
||
| 2998 | * Sets definition. |
||
| 2999 | * |
||
| 3000 | * @param array $definition |
||
| 3001 | * |
||
| 3002 | * @return void |
||
| 3003 | */ |
||
| 3004 | 12 | public function setCustomGeneratorDefinition(array $definition) |
|
| 3008 | |||
| 3009 | /** |
||
| 3010 | * Sets the definition of the sequence ID generator for this class. |
||
| 3011 | * |
||
| 3012 | * The definition must have the following structure: |
||
| 3013 | * <code> |
||
| 3014 | * array( |
||
| 3015 | * 'sequenceName' => 'name', |
||
| 3016 | * 'allocationSize' => 20, |
||
| 3017 | * 'initialValue' => 1 |
||
| 3018 | * 'quoted' => 1 |
||
| 3019 | * ) |
||
| 3020 | * </code> |
||
| 3021 | * |
||
| 3022 | * @param array $definition |
||
| 3023 | * |
||
| 3024 | * @return void |
||
| 3025 | * |
||
| 3026 | * @throws MappingException |
||
| 3027 | */ |
||
| 3028 | 23 | public function setSequenceGeneratorDefinition(array $definition) |
|
| 3041 | |||
| 3042 | /** |
||
| 3043 | * Sets the version field mapping used for versioning. Sets the default |
||
| 3044 | * value to use depending on the column type. |
||
| 3045 | * |
||
| 3046 | * @param array $mapping The version field mapping array. |
||
| 3047 | * |
||
| 3048 | * @return void |
||
| 3049 | * |
||
| 3050 | * @throws MappingException |
||
| 3051 | */ |
||
| 3052 | 25 | public function setVersionMapping(array &$mapping) |
|
| 3067 | |||
| 3068 | /** |
||
| 3069 | * Sets whether this class is to be versioned for optimistic locking. |
||
| 3070 | * |
||
| 3071 | * @param boolean $bool |
||
| 3072 | * |
||
| 3073 | * @return void |
||
| 3074 | */ |
||
| 3075 | 122 | public function setVersioned($bool) |
|
| 3079 | |||
| 3080 | /** |
||
| 3081 | * Sets the name of the field that is to be used for versioning if this class is |
||
| 3082 | * versioned for optimistic locking. |
||
| 3083 | * |
||
| 3084 | * @param string $versionField |
||
| 3085 | * |
||
| 3086 | * @return void |
||
| 3087 | */ |
||
| 3088 | 122 | public function setVersionField($versionField) |
|
| 3092 | |||
| 3093 | /** |
||
| 3094 | * Marks this class as read only, no change tracking is applied to it. |
||
| 3095 | * |
||
| 3096 | * @return void |
||
| 3097 | */ |
||
| 3098 | 3 | public function markReadOnly() |
|
| 3102 | |||
| 3103 | /** |
||
| 3104 | * {@inheritDoc} |
||
| 3105 | */ |
||
| 3106 | public function getFieldNames() |
||
| 3110 | |||
| 3111 | /** |
||
| 3112 | * {@inheritDoc} |
||
| 3113 | */ |
||
| 3114 | public function getAssociationNames() |
||
| 3118 | |||
| 3119 | /** |
||
| 3120 | * {@inheritDoc} |
||
| 3121 | * |
||
| 3122 | * @throws InvalidArgumentException |
||
| 3123 | */ |
||
| 3124 | 1 | public function getAssociationTargetClass($assocName) |
|
| 3132 | |||
| 3133 | /** |
||
| 3134 | * {@inheritDoc} |
||
| 3135 | */ |
||
| 3136 | 704 | public function getName() |
|
| 3140 | |||
| 3141 | /** |
||
| 3142 | * Gets the (possibly quoted) identifier column names for safe use in an SQL statement. |
||
| 3143 | * |
||
| 3144 | * @deprecated Deprecated since version 2.3 in favor of \Doctrine\ORM\Mapping\QuoteStrategy |
||
| 3145 | * |
||
| 3146 | * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform |
||
| 3147 | * |
||
| 3148 | * @return array |
||
| 3149 | */ |
||
| 3150 | public function getQuotedIdentifierColumnNames($platform) |
||
| 3179 | |||
| 3180 | /** |
||
| 3181 | * Gets the (possibly quoted) column name of a mapped field for safe use in an SQL statement. |
||
| 3182 | * |
||
| 3183 | * @deprecated Deprecated since version 2.3 in favor of \Doctrine\ORM\Mapping\QuoteStrategy |
||
| 3184 | * |
||
| 3185 | * @param string $field |
||
| 3186 | * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform |
||
| 3187 | * |
||
| 3188 | * @return string |
||
| 3189 | */ |
||
| 3190 | public function getQuotedColumnName($field, $platform) |
||
| 3196 | |||
| 3197 | /** |
||
| 3198 | * Gets the (possibly quoted) primary table name of this class for safe use in an SQL statement. |
||
| 3199 | * |
||
| 3200 | * @deprecated Deprecated since version 2.3 in favor of \Doctrine\ORM\Mapping\QuoteStrategy |
||
| 3201 | * |
||
| 3202 | * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform |
||
| 3203 | * |
||
| 3204 | * @return string |
||
| 3205 | */ |
||
| 3206 | public function getQuotedTableName($platform) |
||
| 3212 | |||
| 3213 | /** |
||
| 3214 | * Gets the (possibly quoted) name of the join table. |
||
| 3215 | * |
||
| 3216 | * @deprecated Deprecated since version 2.3 in favor of \Doctrine\ORM\Mapping\QuoteStrategy |
||
| 3217 | * |
||
| 3218 | * @param array $assoc |
||
| 3219 | * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform |
||
| 3220 | * |
||
| 3221 | * @return string |
||
| 3222 | */ |
||
| 3223 | public function getQuotedJoinTableName(array $assoc, $platform) |
||
| 3229 | |||
| 3230 | /** |
||
| 3231 | * {@inheritDoc} |
||
| 3232 | */ |
||
| 3233 | 12 | public function isAssociationInverseSide($fieldName) |
|
| 3238 | |||
| 3239 | /** |
||
| 3240 | * {@inheritDoc} |
||
| 3241 | */ |
||
| 3242 | public function getAssociationMappedByTargetField($fieldName) |
||
| 3246 | |||
| 3247 | /** |
||
| 3248 | * @param string $targetClass |
||
| 3249 | * |
||
| 3250 | * @return array |
||
| 3251 | */ |
||
| 3252 | 2 | public function getAssociationsByTargetClass($targetClass) |
|
| 3264 | |||
| 3265 | /** |
||
| 3266 | * @param string|null $className |
||
| 3267 | * |
||
| 3268 | * @return string|null null if the input value is null |
||
| 3269 | */ |
||
| 3270 | 475 | public function fullyQualifiedClassName($className) |
|
| 3282 | |||
| 3283 | /** |
||
| 3284 | * @param string $name |
||
| 3285 | * |
||
| 3286 | * @return mixed |
||
| 3287 | */ |
||
| 3288 | 2 | public function getMetadataValue($name) |
|
| 3297 | |||
| 3298 | /** |
||
| 3299 | * Map Embedded Class |
||
| 3300 | * |
||
| 3301 | * @param array $mapping |
||
| 3302 | * |
||
| 3303 | * @throws MappingException |
||
| 3304 | * @return void |
||
| 3305 | */ |
||
| 3306 | 26 | public function mapEmbedded(array $mapping) |
|
| 3317 | |||
| 3318 | /** |
||
| 3319 | * Inline the embeddable class |
||
| 3320 | * |
||
| 3321 | * @param string $property |
||
| 3322 | * @param ClassMetadataInfo $embeddable |
||
| 3323 | */ |
||
| 3324 | 10 | public function inlineEmbeddable($property, ClassMetadataInfo $embeddable) |
|
| 3353 | |||
| 3354 | /** |
||
| 3355 | * @param string $fieldName |
||
| 3356 | * @throws MappingException |
||
| 3357 | */ |
||
| 3358 | 562 | private function assertFieldNotMapped($fieldName) |
|
| 3367 | |||
| 3368 | /** |
||
| 3369 | * Gets the sequence name based on class metadata. |
||
| 3370 | * |
||
| 3371 | * @param AbstractPlatform $platform |
||
| 3372 | * @return string |
||
| 3373 | * |
||
| 3374 | * @todo Sequence names should be computed in DBAL depending on the platform |
||
| 3375 | */ |
||
| 3376 | 3 | public function getSequenceName(AbstractPlatform $platform) |
|
| 3384 | |||
| 3385 | /** |
||
| 3386 | * Gets the sequence name prefix based on class metadata. |
||
| 3387 | * |
||
| 3388 | * @param AbstractPlatform $platform |
||
| 3389 | * @return string |
||
| 3390 | * |
||
| 3391 | * @todo Sequence names should be computed in DBAL depending on the platform |
||
| 3392 | */ |
||
| 3393 | 3 | public function getSequencePrefix(AbstractPlatform $platform) |
|
| 3409 | } |
||
| 3410 |
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: