Complex classes like Configuration 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 Configuration, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 54 | class Configuration extends \Doctrine\DBAL\Configuration |
||
| 55 | { |
||
| 56 | /** |
||
| 57 | * Sets the directory where Doctrine generates any necessary proxy class files. |
||
| 58 | * |
||
| 59 | * @param string $dir |
||
| 60 | * |
||
| 61 | * @return void |
||
| 62 | */ |
||
| 63 | 2339 | public function setProxyDir($dir) |
|
| 67 | |||
| 68 | /** |
||
| 69 | * Gets the directory where Doctrine generates any necessary proxy class files. |
||
| 70 | * |
||
| 71 | * @return string|null |
||
| 72 | */ |
||
| 73 | 2335 | public function getProxyDir() |
|
| 79 | |||
| 80 | /** |
||
| 81 | * Gets the strategy for automatically generating proxy classes. |
||
| 82 | * |
||
| 83 | * @return int Possible values are constants of Doctrine\Common\Proxy\AbstractProxyFactory. |
||
| 84 | */ |
||
| 85 | 2337 | public function getAutoGenerateProxyClasses() |
|
| 91 | |||
| 92 | /** |
||
| 93 | * Sets the strategy for automatically generating proxy classes. |
||
| 94 | * |
||
| 95 | * @param boolean|int $autoGenerate Possible values are constants of Doctrine\Common\Proxy\AbstractProxyFactory. |
||
| 96 | * True is converted to AUTOGENERATE_ALWAYS, false to AUTOGENERATE_NEVER. |
||
| 97 | * |
||
| 98 | * @return void |
||
| 99 | */ |
||
| 100 | 15 | public function setAutoGenerateProxyClasses($autoGenerate) |
|
| 104 | |||
| 105 | /** |
||
| 106 | * Gets the namespace where proxy classes reside. |
||
| 107 | * |
||
| 108 | * @return string|null |
||
| 109 | */ |
||
| 110 | 2334 | public function getProxyNamespace() |
|
| 116 | |||
| 117 | /** |
||
| 118 | * Sets the namespace where proxy classes reside. |
||
| 119 | * |
||
| 120 | * @param string $ns |
||
| 121 | * |
||
| 122 | * @return void |
||
| 123 | */ |
||
| 124 | 2339 | public function setProxyNamespace($ns) |
|
| 128 | |||
| 129 | /** |
||
| 130 | * Sets the cache driver implementation that is used for metadata caching. |
||
| 131 | * |
||
| 132 | * @param MappingDriver $driverImpl |
||
| 133 | * |
||
| 134 | * @return void |
||
| 135 | * |
||
| 136 | * @todo Force parameter to be a Closure to ensure lazy evaluation |
||
| 137 | * (as soon as a metadata cache is in effect, the driver never needs to initialize). |
||
| 138 | */ |
||
| 139 | 2338 | public function setMetadataDriverImpl(MappingDriver $driverImpl) |
|
| 143 | |||
| 144 | /** |
||
| 145 | * Adds a new default annotation driver with a correctly configured annotation reader. If $useSimpleAnnotationReader |
||
| 146 | * is true, the notation `@Entity` will work, otherwise, the notation `@ORM\Entity` will be supported. |
||
| 147 | * |
||
| 148 | * @param array $paths |
||
| 149 | * @param bool $useSimpleAnnotationReader |
||
| 150 | * |
||
| 151 | * @return AnnotationDriver |
||
| 152 | */ |
||
| 153 | 2314 | public function newDefaultAnnotationDriver($paths = array(), $useSimpleAnnotationReader = true) |
|
| 171 | |||
| 172 | /** |
||
| 173 | * Adds a namespace under a certain alias. |
||
| 174 | * |
||
| 175 | * @param string $alias |
||
| 176 | * @param string $namespace |
||
| 177 | * |
||
| 178 | * @return void |
||
| 179 | */ |
||
| 180 | 8 | public function addEntityNamespace($alias, $namespace) |
|
| 184 | |||
| 185 | /** |
||
| 186 | * Resolves a registered namespace alias to the full namespace. |
||
| 187 | * |
||
| 188 | * @param string $entityNamespaceAlias |
||
| 189 | * |
||
| 190 | * @return string |
||
| 191 | * |
||
| 192 | * @throws ORMException |
||
| 193 | */ |
||
| 194 | 13 | public function getEntityNamespace($entityNamespaceAlias) |
|
| 202 | |||
| 203 | /** |
||
| 204 | * Sets the entity alias map. |
||
| 205 | * |
||
| 206 | * @param array $entityNamespaces |
||
| 207 | * |
||
| 208 | * @return void |
||
| 209 | */ |
||
| 210 | 93 | public function setEntityNamespaces(array $entityNamespaces) |
|
| 214 | |||
| 215 | /** |
||
| 216 | * Retrieves the list of registered entity namespace aliases. |
||
| 217 | * |
||
| 218 | * @return array |
||
| 219 | */ |
||
| 220 | 1 | public function getEntityNamespaces() |
|
| 224 | |||
| 225 | /** |
||
| 226 | * Gets the cache driver implementation that is used for the mapping metadata. |
||
| 227 | * |
||
| 228 | * @return MappingDriver|null |
||
| 229 | * |
||
| 230 | * @throws ORMException |
||
| 231 | */ |
||
| 232 | 1469 | public function getMetadataDriverImpl() |
|
| 238 | |||
| 239 | /** |
||
| 240 | * Gets the cache driver implementation that is used for the query cache (SQL cache). |
||
| 241 | * |
||
| 242 | * @return \Doctrine\Common\Cache\Cache|null |
||
| 243 | */ |
||
| 244 | 566 | public function getQueryCacheImpl() |
|
| 250 | |||
| 251 | /** |
||
| 252 | * Sets the cache driver implementation that is used for the query cache (SQL cache). |
||
| 253 | * |
||
| 254 | * @param \Doctrine\Common\Cache\Cache $cacheImpl |
||
| 255 | * |
||
| 256 | * @return void |
||
| 257 | */ |
||
| 258 | 2292 | public function setQueryCacheImpl(CacheDriver $cacheImpl) |
|
| 262 | |||
| 263 | /** |
||
| 264 | * Gets the cache driver implementation that is used for the hydration cache (SQL cache). |
||
| 265 | * |
||
| 266 | * @return \Doctrine\Common\Cache\Cache|null |
||
| 267 | */ |
||
| 268 | 1 | public function getHydrationCacheImpl() |
|
| 274 | |||
| 275 | /** |
||
| 276 | * Sets the cache driver implementation that is used for the hydration cache (SQL cache). |
||
| 277 | * |
||
| 278 | * @param \Doctrine\Common\Cache\Cache $cacheImpl |
||
| 279 | * |
||
| 280 | * @return void |
||
| 281 | */ |
||
| 282 | 1 | public function setHydrationCacheImpl(CacheDriver $cacheImpl) |
|
| 286 | |||
| 287 | /** |
||
| 288 | * Gets the cache driver implementation that is used for metadata caching. |
||
| 289 | * |
||
| 290 | * @return \Doctrine\Common\Cache\Cache|null |
||
| 291 | */ |
||
| 292 | 2341 | public function getMetadataCacheImpl() |
|
| 298 | |||
| 299 | /** |
||
| 300 | * Sets the cache driver implementation that is used for metadata caching. |
||
| 301 | * |
||
| 302 | * @param \Doctrine\Common\Cache\Cache $cacheImpl |
||
| 303 | * |
||
| 304 | * @return void |
||
| 305 | */ |
||
| 306 | 2292 | public function setMetadataCacheImpl(CacheDriver $cacheImpl) |
|
| 310 | |||
| 311 | /** |
||
| 312 | * Adds a named DQL query to the configuration. |
||
| 313 | * |
||
| 314 | * @param string $name The name of the query. |
||
| 315 | * @param string $dql The DQL query string. |
||
| 316 | * |
||
| 317 | * @return void |
||
| 318 | */ |
||
| 319 | 1 | public function addNamedQuery($name, $dql) |
|
| 323 | |||
| 324 | /** |
||
| 325 | * Gets a previously registered named DQL query. |
||
| 326 | * |
||
| 327 | * @param string $name The name of the query. |
||
| 328 | * |
||
| 329 | * @return string The DQL query. |
||
| 330 | * |
||
| 331 | * @throws ORMException |
||
| 332 | */ |
||
| 333 | 2 | public function getNamedQuery($name) |
|
| 341 | |||
| 342 | /** |
||
| 343 | * Adds a named native query to the configuration. |
||
| 344 | * |
||
| 345 | * @param string $name The name of the query. |
||
| 346 | * @param string $sql The native SQL query string. |
||
| 347 | * @param Query\ResultSetMapping $rsm The ResultSetMapping used for the results of the SQL query. |
||
| 348 | * |
||
| 349 | * @return void |
||
| 350 | */ |
||
| 351 | 1 | public function addNamedNativeQuery($name, $sql, Query\ResultSetMapping $rsm) |
|
| 355 | |||
| 356 | /** |
||
| 357 | * Gets the components of a previously registered named native query. |
||
| 358 | * |
||
| 359 | * @param string $name The name of the query. |
||
| 360 | * |
||
| 361 | * @return array A tuple with the first element being the SQL string and the second |
||
| 362 | * element being the ResultSetMapping. |
||
| 363 | * |
||
| 364 | * @throws ORMException |
||
| 365 | */ |
||
| 366 | 1 | public function getNamedNativeQuery($name) |
|
| 374 | |||
| 375 | /** |
||
| 376 | * Ensures that this Configuration instance contains settings that are |
||
| 377 | * suitable for a production environment. |
||
| 378 | * |
||
| 379 | * @return void |
||
| 380 | * |
||
| 381 | * @throws ORMException If a configuration setting has a value that is not |
||
| 382 | * suitable for a production environment. |
||
| 383 | */ |
||
| 384 | 8 | public function ensureProductionSettings() |
|
| 410 | |||
| 411 | /** |
||
| 412 | * Registers a custom DQL function that produces a string value. |
||
| 413 | * Such a function can then be used in any DQL statement in any place where string |
||
| 414 | * functions are allowed. |
||
| 415 | * |
||
| 416 | * DQL function names are case-insensitive. |
||
| 417 | * |
||
| 418 | * @param string $name Function name. |
||
| 419 | * @param string|callable $className Class name or a callable that returns the function. |
||
| 420 | * |
||
| 421 | * @return void |
||
| 422 | * |
||
| 423 | * @throws ORMException |
||
| 424 | */ |
||
| 425 | 3 | public function addCustomStringFunction($name, $className) |
|
| 433 | |||
| 434 | /** |
||
| 435 | * Gets the implementation class name of a registered custom string DQL function. |
||
| 436 | * |
||
| 437 | * @param string $name |
||
| 438 | * |
||
| 439 | * @return string|null |
||
| 440 | */ |
||
| 441 | 4 | public function getCustomStringFunction($name) |
|
| 449 | |||
| 450 | /** |
||
| 451 | * Sets a map of custom DQL string functions. |
||
| 452 | * |
||
| 453 | * Keys must be function names and values the FQCN of the implementing class. |
||
| 454 | * The function names will be case-insensitive in DQL. |
||
| 455 | * |
||
| 456 | * Any previously added string functions are discarded. |
||
| 457 | * |
||
| 458 | * @param array $functions The map of custom DQL string functions. |
||
| 459 | * |
||
| 460 | * @return void |
||
| 461 | */ |
||
| 462 | 1 | public function setCustomStringFunctions(array $functions) |
|
| 468 | |||
| 469 | /** |
||
| 470 | * Registers a custom DQL function that produces a numeric value. |
||
| 471 | * Such a function can then be used in any DQL statement in any place where numeric |
||
| 472 | * functions are allowed. |
||
| 473 | * |
||
| 474 | * DQL function names are case-insensitive. |
||
| 475 | * |
||
| 476 | * @param string $name Function name. |
||
| 477 | * @param string|callable $className Class name or a callable that returns the function. |
||
| 478 | * |
||
| 479 | * @return void |
||
| 480 | * |
||
| 481 | * @throws ORMException |
||
| 482 | */ |
||
| 483 | 3 | public function addCustomNumericFunction($name, $className) |
|
| 491 | |||
| 492 | /** |
||
| 493 | * Gets the implementation class name of a registered custom numeric DQL function. |
||
| 494 | * |
||
| 495 | * @param string $name |
||
| 496 | * |
||
| 497 | * @return string|null |
||
| 498 | */ |
||
| 499 | 3 | public function getCustomNumericFunction($name) |
|
| 507 | |||
| 508 | /** |
||
| 509 | * Sets a map of custom DQL numeric functions. |
||
| 510 | * |
||
| 511 | * Keys must be function names and values the FQCN of the implementing class. |
||
| 512 | * The function names will be case-insensitive in DQL. |
||
| 513 | * |
||
| 514 | * Any previously added numeric functions are discarded. |
||
| 515 | * |
||
| 516 | * @param array $functions The map of custom DQL numeric functions. |
||
| 517 | * |
||
| 518 | * @return void |
||
| 519 | */ |
||
| 520 | 2 | public function setCustomNumericFunctions(array $functions) |
|
| 526 | |||
| 527 | /** |
||
| 528 | * Registers a custom DQL function that produces a date/time value. |
||
| 529 | * Such a function can then be used in any DQL statement in any place where date/time |
||
| 530 | * functions are allowed. |
||
| 531 | * |
||
| 532 | * DQL function names are case-insensitive. |
||
| 533 | * |
||
| 534 | * @param string $name Function name. |
||
| 535 | * @param string|callable $className Class name or a callable that returns the function. |
||
| 536 | * |
||
| 537 | * @return void |
||
| 538 | * |
||
| 539 | * @throws ORMException |
||
| 540 | */ |
||
| 541 | 1 | public function addCustomDatetimeFunction($name, $className) |
|
| 549 | |||
| 550 | /** |
||
| 551 | * Gets the implementation class name of a registered custom date/time DQL function. |
||
| 552 | * |
||
| 553 | * @param string $name |
||
| 554 | * |
||
| 555 | * @return string|null |
||
| 556 | */ |
||
| 557 | 1 | public function getCustomDatetimeFunction($name) |
|
| 565 | |||
| 566 | /** |
||
| 567 | * Sets a map of custom DQL date/time functions. |
||
| 568 | * |
||
| 569 | * Keys must be function names and values the FQCN of the implementing class. |
||
| 570 | * The function names will be case-insensitive in DQL. |
||
| 571 | * |
||
| 572 | * Any previously added date/time functions are discarded. |
||
| 573 | * |
||
| 574 | * @param array $functions The map of custom DQL date/time functions. |
||
| 575 | * |
||
| 576 | * @return void |
||
| 577 | */ |
||
| 578 | 1 | public function setCustomDatetimeFunctions(array $functions) |
|
| 584 | |||
| 585 | /** |
||
| 586 | * Sets the custom hydrator modes in one pass. |
||
| 587 | * |
||
| 588 | * @param array $modes An array of ($modeName => $hydrator). |
||
| 589 | * |
||
| 590 | * @return void |
||
| 591 | */ |
||
| 592 | 1 | public function setCustomHydrationModes($modes) |
|
| 600 | |||
| 601 | /** |
||
| 602 | * Gets the hydrator class for the given hydration mode name. |
||
| 603 | * |
||
| 604 | * @param string $modeName The hydration mode name. |
||
| 605 | * |
||
| 606 | * @return string|null The hydrator class name. |
||
| 607 | */ |
||
| 608 | 3 | public function getCustomHydrationMode($modeName) |
|
| 614 | |||
| 615 | /** |
||
| 616 | * Adds a custom hydration mode. |
||
| 617 | * |
||
| 618 | * @param string $modeName The hydration mode name. |
||
| 619 | * @param string $hydrator The hydrator class name. |
||
| 620 | * |
||
| 621 | * @return void |
||
| 622 | */ |
||
| 623 | 3 | public function addCustomHydrationMode($modeName, $hydrator) |
|
| 627 | |||
| 628 | /** |
||
| 629 | * Sets a class metadata factory. |
||
| 630 | * |
||
| 631 | * @param string $cmfName |
||
| 632 | * |
||
| 633 | * @return void |
||
| 634 | */ |
||
| 635 | 1 | public function setClassMetadataFactoryName($cmfName) |
|
| 639 | |||
| 640 | /** |
||
| 641 | * @return string |
||
| 642 | */ |
||
| 643 | 2333 | public function getClassMetadataFactoryName() |
|
| 651 | |||
| 652 | /** |
||
| 653 | * Adds a filter to the list of possible filters. |
||
| 654 | * |
||
| 655 | * @param string $name The name of the filter. |
||
| 656 | * @param string $className The class name of the filter. |
||
| 657 | */ |
||
| 658 | 46 | public function addFilter($name, $className) |
|
| 662 | |||
| 663 | /** |
||
| 664 | * Gets the class name for a given filter name. |
||
| 665 | * |
||
| 666 | * @param string $name The name of the filter. |
||
| 667 | * |
||
| 668 | * @return string The class name of the filter, or null if it is not |
||
| 669 | * defined. |
||
| 670 | */ |
||
| 671 | 45 | public function getFilterClassName($name) |
|
| 677 | |||
| 678 | /** |
||
| 679 | * Sets default repository class. |
||
| 680 | * |
||
| 681 | * @since 2.2 |
||
| 682 | * |
||
| 683 | * @param string $className |
||
| 684 | * |
||
| 685 | * @return void |
||
| 686 | * |
||
| 687 | * @throws ORMException If not is a \Doctrine\Common\Persistence\ObjectRepository |
||
| 688 | */ |
||
| 689 | 3 | public function setDefaultRepositoryClassName($className) |
|
| 699 | |||
| 700 | /** |
||
| 701 | * Get default repository class. |
||
| 702 | * |
||
| 703 | * @since 2.2 |
||
| 704 | * |
||
| 705 | * @return string |
||
| 706 | */ |
||
| 707 | 139 | public function getDefaultRepositoryClassName() |
|
| 713 | |||
| 714 | /** |
||
| 715 | * Sets naming strategy. |
||
| 716 | * |
||
| 717 | * @since 2.3 |
||
| 718 | * |
||
| 719 | * @param NamingStrategy $namingStrategy |
||
| 720 | * |
||
| 721 | * @return void |
||
| 722 | */ |
||
| 723 | 7 | public function setNamingStrategy(NamingStrategy $namingStrategy) |
|
| 727 | |||
| 728 | /** |
||
| 729 | * Gets naming strategy.. |
||
| 730 | * |
||
| 731 | * @since 2.3 |
||
| 732 | * |
||
| 733 | * @return NamingStrategy |
||
| 734 | */ |
||
| 735 | 413 | public function getNamingStrategy() |
|
| 743 | |||
| 744 | /** |
||
| 745 | * Sets quote strategy. |
||
| 746 | * |
||
| 747 | * @since 2.3 |
||
| 748 | * |
||
| 749 | * @param \Doctrine\ORM\Mapping\QuoteStrategy $quoteStrategy |
||
| 750 | * |
||
| 751 | * @return void |
||
| 752 | */ |
||
| 753 | 2 | public function setQuoteStrategy(QuoteStrategy $quoteStrategy) |
|
| 757 | |||
| 758 | /** |
||
| 759 | * Gets quote strategy. |
||
| 760 | * |
||
| 761 | * @since 2.3 |
||
| 762 | * |
||
| 763 | * @return \Doctrine\ORM\Mapping\QuoteStrategy |
||
| 764 | */ |
||
| 765 | 1611 | public function getQuoteStrategy() |
|
| 773 | |||
| 774 | /** |
||
| 775 | * Set the entity listener resolver. |
||
| 776 | * |
||
| 777 | * @since 2.4 |
||
| 778 | * @param \Doctrine\ORM\Mapping\EntityListenerResolver $resolver |
||
| 779 | */ |
||
| 780 | 1 | public function setEntityListenerResolver(EntityListenerResolver $resolver) |
|
| 784 | |||
| 785 | /** |
||
| 786 | * Get the entity listener resolver. |
||
| 787 | * |
||
| 788 | * @since 2.4 |
||
| 789 | * @return \Doctrine\ORM\Mapping\EntityListenerResolver |
||
| 790 | */ |
||
| 791 | 2333 | public function getEntityListenerResolver() |
|
| 799 | |||
| 800 | /** |
||
| 801 | * Set the entity repository factory. |
||
| 802 | * |
||
| 803 | * @since 2.4 |
||
| 804 | * @param \Doctrine\ORM\Repository\RepositoryFactory $repositoryFactory |
||
| 805 | */ |
||
| 806 | public function setRepositoryFactory(RepositoryFactory $repositoryFactory) |
||
| 810 | |||
| 811 | /** |
||
| 812 | * Get the entity repository factory. |
||
| 813 | * |
||
| 814 | * @since 2.4 |
||
| 815 | * @return \Doctrine\ORM\Repository\RepositoryFactory |
||
| 816 | */ |
||
| 817 | 2332 | public function getRepositoryFactory() |
|
| 823 | |||
| 824 | /** |
||
| 825 | * @since 2.5 |
||
| 826 | * |
||
| 827 | * @return boolean |
||
| 828 | */ |
||
| 829 | 2333 | public function isSecondLevelCacheEnabled() |
|
| 835 | |||
| 836 | /** |
||
| 837 | * @since 2.5 |
||
| 838 | * |
||
| 839 | * @param boolean $flag |
||
| 840 | * |
||
| 841 | * @return void |
||
| 842 | */ |
||
| 843 | 275 | public function setSecondLevelCacheEnabled($flag = true) |
|
| 847 | |||
| 848 | /** |
||
| 849 | * @since 2.5 |
||
| 850 | * |
||
| 851 | * @param \Doctrine\ORM\Cache\CacheConfiguration $cacheConfig |
||
| 852 | * |
||
| 853 | * @return void |
||
| 854 | */ |
||
| 855 | 276 | public function setSecondLevelCacheConfiguration(CacheConfiguration $cacheConfig) |
|
| 859 | |||
| 860 | /** |
||
| 861 | * @since 2.5 |
||
| 862 | * |
||
| 863 | * @return \Doctrine\ORM\Cache\CacheConfiguration|null |
||
| 864 | */ |
||
| 865 | 276 | public function getSecondLevelCacheConfiguration() |
|
| 875 | |||
| 876 | /** |
||
| 877 | * Returns query hints, which will be applied to every query in application |
||
| 878 | * |
||
| 879 | * @since 2.5 |
||
| 880 | * |
||
| 881 | * @return array |
||
| 882 | */ |
||
| 883 | 943 | public function getDefaultQueryHints() |
|
| 887 | |||
| 888 | /** |
||
| 889 | * Sets array of query hints, which will be applied to every query in application |
||
| 890 | * |
||
| 891 | * @since 2.5 |
||
| 892 | * |
||
| 893 | * @param array $defaultQueryHints |
||
| 894 | */ |
||
| 895 | 1 | public function setDefaultQueryHints(array $defaultQueryHints) |
|
| 899 | |||
| 900 | /** |
||
| 901 | * Gets the value of a default query hint. If the hint name is not recognized, FALSE is returned. |
||
| 902 | * |
||
| 903 | * @since 2.5 |
||
| 904 | * |
||
| 905 | * @param string $name The name of the hint. |
||
| 906 | * |
||
| 907 | * @return mixed The value of the hint or FALSE, if the hint name is not recognized. |
||
| 908 | */ |
||
| 909 | public function getDefaultQueryHint($name) |
||
| 915 | |||
| 916 | /** |
||
| 917 | * Sets a default query hint. If the hint name is not recognized, it is silently ignored. |
||
| 918 | * |
||
| 919 | * @since 2.5 |
||
| 920 | * |
||
| 921 | * @param string $name The name of the hint. |
||
| 922 | * @param mixed $value The value of the hint. |
||
| 923 | */ |
||
| 924 | 1 | public function setDefaultQueryHint($name, $value) |
|
| 928 | |||
| 929 | /** |
||
| 930 | * Gets the type of the result set root that should be returned. By default its an array, but we can set it as |
||
| 931 | * 'collection', in which case the ORM returns the collection specified for the entity contained in the result set. |
||
| 932 | * |
||
| 933 | * @since 2.5 |
||
| 934 | * |
||
| 935 | * @return string $type The name of the type: 'array' or 'collection'. |
||
| 936 | */ |
||
| 937 | 67 | public function getResultRootType() |
|
| 943 | |||
| 944 | /** |
||
| 945 | * Gets the type of the result set root that should be returned. By default its an array, but we can set it as |
||
| 946 | * 'collection', in which case the ORM returns the collection specified for the entity contained in the result set. |
||
| 947 | * |
||
| 948 | * @since 2.5 |
||
| 949 | * |
||
| 950 | * @param string $type The name of the type: 'array' or 'collection'. |
||
| 951 | */ |
||
| 952 | 5 | public function setResultRootType($type) |
|
| 956 | } |
||
| 957 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: