| Conditions | 1 |
| Paths | 1 |
| Total Lines | 170 |
| Code Lines | 63 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 121 | public function getDoctrineConfig() |
||
| 122 | { |
||
| 123 | return [ |
||
| 124 | 'connection' => [ |
||
| 125 | // Configuration for service `doctrine.connection.orm_default` service |
||
| 126 | 'orm_default' => [ |
||
| 127 | // configuration instance to use. The retrieved service name will |
||
| 128 | // be `doctrine.configuration.$thisSetting` |
||
| 129 | 'configuration' => 'orm_default', |
||
| 130 | |||
| 131 | // event manager instance to use. The retrieved service name will |
||
| 132 | // be `doctrine.eventmanager.$thisSetting` |
||
| 133 | 'eventmanager' => 'orm_default', |
||
| 134 | |||
| 135 | // connection parameters, see |
||
| 136 | // http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html |
||
| 137 | 'params' => [ |
||
| 138 | 'host' => 'localhost', |
||
| 139 | 'port' => '3306', |
||
| 140 | 'user' => 'username', |
||
| 141 | 'password' => 'password', |
||
| 142 | 'dbname' => 'database', |
||
| 143 | ], |
||
| 144 | ], |
||
| 145 | ], |
||
| 146 | |||
| 147 | // Configuration details for the ORM. |
||
| 148 | // See http://docs.doctrine-project.org/en/latest/reference/configuration.html |
||
| 149 | 'configuration' => [ |
||
| 150 | // Configuration for service `doctrine.configuration.orm_default` service |
||
| 151 | 'orm_default' => [ |
||
| 152 | // metadata cache instance to use. The retrieved service name will |
||
| 153 | // be `doctrine.cache.$thisSetting` |
||
| 154 | 'metadata_cache' => 'array', |
||
| 155 | |||
| 156 | // DQL queries parsing cache instance to use. The retrieved service |
||
| 157 | // name will be `doctrine.cache.$thisSetting` |
||
| 158 | 'query_cache' => 'array', |
||
| 159 | |||
| 160 | // ResultSet cache to use. The retrieved service name will be |
||
| 161 | // `doctrine.cache.$thisSetting` |
||
| 162 | 'result_cache' => 'array', |
||
| 163 | |||
| 164 | // Hydration cache to use. The retrieved service name will be |
||
| 165 | // `doctrine.cache.$thisSetting` |
||
| 166 | 'hydration_cache' => 'array', |
||
| 167 | |||
| 168 | // Mapping driver instance to use. Change this only if you don't want |
||
| 169 | // to use the default chained driver. The retrieved service name will |
||
| 170 | // be `doctrine.driver.$thisSetting` |
||
| 171 | 'driver' => 'orm_default', |
||
| 172 | |||
| 173 | // Generate proxies automatically (turn off for production) |
||
| 174 | 'generate_proxies' => true, |
||
| 175 | |||
| 176 | // directory where proxies will be stored. By default, this is in |
||
| 177 | // the `data` directory of your application |
||
| 178 | 'proxy_dir' => 'data/DoctrineORMModule/Proxy', |
||
| 179 | |||
| 180 | // namespace for generated proxy classes |
||
| 181 | 'proxy_namespace' => 'DoctrineORMModule\Proxy', |
||
| 182 | |||
| 183 | // SQL filters. See http://docs.doctrine-project.org/en/latest/reference/filters.html |
||
| 184 | 'filters' => [], |
||
| 185 | |||
| 186 | // Custom DQL functions. |
||
| 187 | // You can grab common MySQL ones at https://github.com/beberlei/DoctrineExtensions |
||
| 188 | // Further docs at |
||
| 189 | // http://docs.doctrine-project.org/en/latest/cookbook/dql-user-defined-functions.html |
||
| 190 | 'datetime_functions' => [], |
||
| 191 | 'string_functions' => [], |
||
| 192 | 'numeric_functions' => [], |
||
| 193 | |||
| 194 | // Second level cache configuration (see doc to learn about configuration) |
||
| 195 | 'second_level_cache' => [], |
||
| 196 | ], |
||
| 197 | ], |
||
| 198 | |||
| 199 | // Metadata Mapping driver configuration |
||
| 200 | 'driver' => [ |
||
| 201 | // Configuration for service `doctrine.driver.orm_default` service |
||
| 202 | 'orm_default' => [ |
||
| 203 | // By default, the ORM module uses a driver chain. This allows multiple |
||
| 204 | // modules to define their own entities |
||
| 205 | 'class' => MappingDriverChain::class, |
||
| 206 | |||
| 207 | // Map of driver names to be used within this driver chain, indexed by |
||
| 208 | // entity namespace |
||
| 209 | 'drivers' => [], |
||
| 210 | ], |
||
| 211 | ], |
||
| 212 | |||
| 213 | // Entity Manager instantiation settings |
||
| 214 | 'entitymanager' => [ |
||
| 215 | // configuration for the `doctrine.entitymanager.orm_default` service |
||
| 216 | 'orm_default' => [ |
||
| 217 | // connection instance to use. The retrieved service name will |
||
| 218 | // be `doctrine.connection.$thisSetting` |
||
| 219 | 'connection' => 'orm_default', |
||
| 220 | |||
| 221 | // configuration instance to use. The retrieved service name will |
||
| 222 | // be `doctrine.configuration.$thisSetting` |
||
| 223 | 'configuration' => 'orm_default', |
||
| 224 | ], |
||
| 225 | ], |
||
| 226 | |||
| 227 | 'eventmanager' => [ |
||
| 228 | // configuration for the `doctrine.eventmanager.orm_default` service |
||
| 229 | 'orm_default' => [], |
||
| 230 | ], |
||
| 231 | |||
| 232 | // SQL logger collector, used when ZendDeveloperTools and its toolbar are active |
||
| 233 | 'sql_logger_collector' => [ |
||
| 234 | // configuration for the `doctrine.sql_logger_collector.orm_default` service |
||
| 235 | 'orm_default' => [], |
||
| 236 | ], |
||
| 237 | |||
| 238 | // mappings collector, used when ZendDeveloperTools and its toolbar are active |
||
| 239 | 'mapping_collector' => [ |
||
| 240 | // configuration for the `doctrine.sql_logger_collector.orm_default` service |
||
| 241 | 'orm_default' => [], |
||
| 242 | ], |
||
| 243 | |||
| 244 | // form annotation builder configuration |
||
| 245 | 'formannotationbuilder' => [ |
||
| 246 | // Configuration for service `doctrine.formannotationbuilder.orm_default` service |
||
| 247 | 'orm_default' => [], |
||
| 248 | ], |
||
| 249 | |||
| 250 | // entity resolver configuration, allows mapping associations to interfaces |
||
| 251 | 'entity_resolver' => [ |
||
| 252 | // configuration for the `doctrine.entity_resolver.orm_default` service |
||
| 253 | 'orm_default' => [], |
||
| 254 | ], |
||
| 255 | |||
| 256 | // authentication service configuration |
||
| 257 | 'authentication' => [ |
||
| 258 | // configuration for the `doctrine.authentication.orm_default` authentication service |
||
| 259 | 'orm_default' => [ |
||
| 260 | // name of the object manager to use. By default, the EntityManager is used |
||
| 261 | 'objectManager' => 'doctrine.entitymanager.orm_default', |
||
| 262 | //'identityClass' => 'Application\Model\User', |
||
| 263 | //'identityProperty' => 'username', |
||
| 264 | //'credentialProperty' => 'password', |
||
| 265 | ], |
||
| 266 | ], |
||
| 267 | |||
| 268 | // migrations configuration |
||
| 269 | 'migrations_configuration' => [ |
||
| 270 | 'orm_default' => [ |
||
| 271 | 'directory' => 'data/DoctrineORMModule/Migrations', |
||
| 272 | 'name' => 'Doctrine Database Migrations', |
||
| 273 | 'namespace' => 'DoctrineORMModule\Migrations', |
||
| 274 | 'table' => 'migrations', |
||
| 275 | 'column' => 'version', |
||
| 276 | ], |
||
| 277 | ], |
||
| 278 | |||
| 279 | // migrations commands base config |
||
| 280 | 'migrations_cmd' => [ |
||
| 281 | 'generate' => [], |
||
| 282 | 'execute' => [], |
||
| 283 | 'migrate' => [], |
||
| 284 | 'status' => [], |
||
| 285 | 'version' => [], |
||
| 286 | 'diff' => [], |
||
| 287 | 'latest' => [], |
||
| 288 | ], |
||
| 289 | ]; |
||
| 290 | } |
||
| 291 | |||
| 395 |