Conditions | 1 |
Paths | 1 |
Total Lines | 251 |
Code Lines | 2 |
Lines | 0 |
Ratio | 0 % |
Changes | 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 |
||
297 | protected function getConfigPath() |
||
298 | { |
||
299 | /** mshop/customer/manager/property/type/standard/insert/mysql |
||
300 | * Inserts a new customer property type record into the database table |
||
301 | * |
||
302 | * @see mshop/customer/manager/property/type/standard/insert/ansi |
||
303 | */ |
||
304 | |||
305 | /** mshop/customer/manager/property/type/standard/insert/ansi |
||
306 | * Inserts a new customer property type record into the database table |
||
307 | * |
||
308 | * Items with no ID yet (i.e. the ID is NULL) will be created in |
||
309 | * the database and the newly created ID retrieved afterwards |
||
310 | * using the "newid" SQL statement. |
||
311 | * |
||
312 | * The SQL statement must be a string suitable for being used as |
||
313 | * prepared statement. It must include question marks for binding |
||
314 | * the values from the customer type item to the statement before they are |
||
315 | * sent to the database server. The number of question marks must |
||
316 | * be the same as the number of columns listed in the INSERT |
||
317 | * statement. The order of the columns must correspond to the |
||
318 | * order in the saveItems() method, so the correct values are |
||
319 | * bound to the columns. |
||
320 | * |
||
321 | * The SQL statement should conform to the ANSI standard to be |
||
322 | * compatible with most relational database systems. This also |
||
323 | * includes using double quotes for table and column names. |
||
324 | * |
||
325 | * @param string SQL statement for inserting records |
||
326 | * @since 2018.07 |
||
327 | * @category Developer |
||
328 | * @see mshop/customer/manager/property/type/standard/update/ansi |
||
329 | * @see mshop/customer/manager/property/type/standard/newid/ansi |
||
330 | * @see mshop/customer/manager/property/type/standard/delete/ansi |
||
331 | * @see mshop/customer/manager/property/type/standard/search/ansi |
||
332 | * @see mshop/customer/manager/property/type/standard/count/ansi |
||
333 | */ |
||
334 | |||
335 | /** mshop/customer/manager/property/type/standard/update/mysql |
||
336 | * Updates an existing customer property type record in the database |
||
337 | * |
||
338 | * @see mshop/customer/manager/property/type/standard/update/ansi |
||
339 | */ |
||
340 | |||
341 | /** mshop/customer/manager/property/type/standard/update/ansi |
||
342 | * Updates an existing customer property type record in the database |
||
343 | * |
||
344 | * Items which already have an ID (i.e. the ID is not NULL) will |
||
345 | * be updated in the database. |
||
346 | * |
||
347 | * The SQL statement must be a string suitable for being used as |
||
348 | * prepared statement. It must include question marks for binding |
||
349 | * the values from the customer type item to the statement before they are |
||
350 | * sent to the database server. The order of the columns must |
||
351 | * correspond to the order in the saveItems() method, so the |
||
352 | * correct values are bound to the columns. |
||
353 | * |
||
354 | * The SQL statement should conform to the ANSI standard to be |
||
355 | * compatible with most relational database systems. This also |
||
356 | * includes using double quotes for table and column names. |
||
357 | * |
||
358 | * @param string SQL statement for updating records |
||
359 | * @since 2018.07 |
||
360 | * @category Developer |
||
361 | * @see mshop/customer/manager/property/type/standard/insert/ansi |
||
362 | * @see mshop/customer/manager/property/type/standard/newid/ansi |
||
363 | * @see mshop/customer/manager/property/type/standard/delete/ansi |
||
364 | * @see mshop/customer/manager/property/type/standard/search/ansi |
||
365 | * @see mshop/customer/manager/property/type/standard/count/ansi |
||
366 | */ |
||
367 | |||
368 | /** mshop/customer/manager/property/type/standard/newid/mysql |
||
369 | * Retrieves the ID generated by the database when inserting a new record |
||
370 | * |
||
371 | * @see mshop/customer/manager/property/type/standard/newid/ansi |
||
372 | */ |
||
373 | |||
374 | /** mshop/customer/manager/property/type/standard/newid/ansi |
||
375 | * Retrieves the ID generated by the database when inserting a new record |
||
376 | * |
||
377 | * As soon as a new record is inserted into the database table, |
||
378 | * the database server generates a new and unique identifier for |
||
379 | * that record. This ID can be used for retrieving, updating and |
||
380 | * deleting that specific record from the table again. |
||
381 | * |
||
382 | * For MySQL: |
||
383 | * SELECT LAST_INSERT_ID() |
||
384 | * For PostgreSQL: |
||
385 | * SELECT currval('seq_mcusprty_id') |
||
386 | * For SQL Server: |
||
387 | * SELECT SCOPE_IDENTITY() |
||
388 | * For Oracle: |
||
389 | * SELECT "seq_mcusprty_id".CURRVAL FROM DUAL |
||
390 | * |
||
391 | * There's no way to retrive the new ID by a SQL statements that |
||
392 | * fits for most database servers as they implement their own |
||
393 | * specific way. |
||
394 | * |
||
395 | * @param string SQL statement for retrieving the last inserted record ID |
||
396 | * @since 2018.07 |
||
397 | * @category Developer |
||
398 | * @see mshop/customer/manager/property/type/standard/insert/ansi |
||
399 | * @see mshop/customer/manager/property/type/standard/update/ansi |
||
400 | * @see mshop/customer/manager/property/type/standard/delete/ansi |
||
401 | * @see mshop/customer/manager/property/type/standard/search/ansi |
||
402 | * @see mshop/customer/manager/property/type/standard/count/ansi |
||
403 | */ |
||
404 | |||
405 | /** mshop/customer/manager/property/type/standard/delete/mysql |
||
406 | * Deletes the items matched by the given IDs from the database |
||
407 | * |
||
408 | * @see mshop/customer/manager/property/type/standard/delete/ansi |
||
409 | */ |
||
410 | |||
411 | /** mshop/customer/manager/property/type/standard/delete/ansi |
||
412 | * Deletes the items matched by the given IDs from the database |
||
413 | * |
||
414 | * Removes the records specified by the given IDs from the customer database. |
||
415 | * The records must be from the site that is configured via the |
||
416 | * context item. |
||
417 | * |
||
418 | * The ":cond" placeholder is replaced by the name of the ID column and |
||
419 | * the given ID or list of IDs while the site ID is bound to the question |
||
420 | * mark. |
||
421 | * |
||
422 | * The SQL statement should conform to the ANSI standard to be |
||
423 | * compatible with most relational database systems. This also |
||
424 | * includes using double quotes for table and column names. |
||
425 | * |
||
426 | * @param string SQL statement for deleting items |
||
427 | * @since 2018.07 |
||
428 | * @category Developer |
||
429 | * @see mshop/customer/manager/property/type/standard/insert/ansi |
||
430 | * @see mshop/customer/manager/property/type/standard/update/ansi |
||
431 | * @see mshop/customer/manager/property/type/standard/newid/ansi |
||
432 | * @see mshop/customer/manager/property/type/standard/search/ansi |
||
433 | * @see mshop/customer/manager/property/type/standard/count/ansi |
||
434 | */ |
||
435 | |||
436 | /** mshop/customer/manager/property/type/standard/search/mysql |
||
437 | * Retrieves the records matched by the given criteria in the database |
||
438 | * |
||
439 | * @see mshop/customer/manager/property/type/standard/search/ansi |
||
440 | */ |
||
441 | |||
442 | /** mshop/customer/manager/property/type/standard/search/ansi |
||
443 | * Retrieves the records matched by the given criteria in the database |
||
444 | * |
||
445 | * Fetches the records matched by the given criteria from the customer |
||
446 | * database. The records must be from one of the sites that are |
||
447 | * configured via the context item. If the current site is part of |
||
448 | * a tree of sites, the SELECT statement can retrieve all records |
||
449 | * from the current site and the complete sub-tree of sites. |
||
450 | * |
||
451 | * As the records can normally be limited by criteria from sub-managers, |
||
452 | * their tables must be joined in the SQL context. This is done by |
||
453 | * using the "internaldeps" property from the definition of the ID |
||
454 | * column of the sub-managers. These internal dependencies specify |
||
455 | * the JOIN between the tables and the used columns for joining. The |
||
456 | * ":joins" placeholder is then replaced by the JOIN strings from |
||
457 | * the sub-managers. |
||
458 | * |
||
459 | * To limit the records matched, conditions can be added to the given |
||
460 | * criteria object. It can contain comparisons like column names that |
||
461 | * must match specific values which can be combined by AND, OR or NOT |
||
462 | * operators. The resulting string of SQL conditions replaces the |
||
463 | * ":cond" placeholder before the statement is sent to the database |
||
464 | * server. |
||
465 | * |
||
466 | * If the records that are retrieved should be ordered by one or more |
||
467 | * columns, the generated string of column / sort direction pairs |
||
468 | * replaces the ":order" placeholder. In case no ordering is required, |
||
469 | * the complete ORDER BY part including the "\/*-orderby*\/...\/*orderby-*\/" |
||
470 | * markers is removed to speed up retrieving the records. Columns of |
||
471 | * sub-managers can also be used for ordering the result set but then |
||
472 | * no index can be used. |
||
473 | * |
||
474 | * The number of returned records can be limited and can start at any |
||
475 | * number between the begining and the end of the result set. For that |
||
476 | * the ":size" and ":start" placeholders are replaced by the |
||
477 | * corresponding values from the criteria object. The default values |
||
478 | * are 0 for the start and 100 for the size value. |
||
479 | * |
||
480 | * The SQL statement should conform to the ANSI standard to be |
||
481 | * compatible with most relational database systems. This also |
||
482 | * includes using double quotes for table and column names. |
||
483 | * |
||
484 | * @param string SQL statement for searching items |
||
485 | * @since 2018.07 |
||
486 | * @category Developer |
||
487 | * @see mshop/customer/manager/property/type/standard/insert/ansi |
||
488 | * @see mshop/customer/manager/property/type/standard/update/ansi |
||
489 | * @see mshop/customer/manager/property/type/standard/newid/ansi |
||
490 | * @see mshop/customer/manager/property/type/standard/delete/ansi |
||
491 | * @see mshop/customer/manager/property/type/standard/count/ansi |
||
492 | */ |
||
493 | |||
494 | /** mshop/customer/manager/property/type/standard/count/mysql |
||
495 | * Counts the number of records matched by the given criteria in the database |
||
496 | * |
||
497 | * @see mshop/customer/manager/property/type/standard/count/ansi |
||
498 | */ |
||
499 | |||
500 | /** mshop/customer/manager/property/type/standard/count/ansi |
||
501 | * Counts the number of records matched by the given criteria in the database |
||
502 | * |
||
503 | * Counts all records matched by the given criteria from the customer |
||
504 | * database. The records must be from one of the sites that are |
||
505 | * configured via the context item. If the current site is part of |
||
506 | * a tree of sites, the statement can count all records from the |
||
507 | * current site and the complete sub-tree of sites. |
||
508 | * |
||
509 | * As the records can normally be limited by criteria from sub-managers, |
||
510 | * their tables must be joined in the SQL context. This is done by |
||
511 | * using the "internaldeps" property from the definition of the ID |
||
512 | * column of the sub-managers. These internal dependencies specify |
||
513 | * the JOIN between the tables and the used columns for joining. The |
||
514 | * ":joins" placeholder is then replaced by the JOIN strings from |
||
515 | * the sub-managers. |
||
516 | * |
||
517 | * To limit the records matched, conditions can be added to the given |
||
518 | * criteria object. It can contain comparisons like column names that |
||
519 | * must match specific values which can be combined by AND, OR or NOT |
||
520 | * operators. The resulting string of SQL conditions replaces the |
||
521 | * ":cond" placeholder before the statement is sent to the database |
||
522 | * server. |
||
523 | * |
||
524 | * Both, the strings for ":joins" and for ":cond" are the same as for |
||
525 | * the "search" SQL statement. |
||
526 | * |
||
527 | * Contrary to the "search" statement, it doesn't return any records |
||
528 | * but instead the number of records that have been found. As counting |
||
529 | * thousands of records can be a long running task, the maximum number |
||
530 | * of counted records is limited for performance reasons. |
||
531 | * |
||
532 | * The SQL statement should conform to the ANSI standard to be |
||
533 | * compatible with most relational database systems. This also |
||
534 | * includes using double quotes for table and column names. |
||
535 | * |
||
536 | * @param string SQL statement for counting items |
||
537 | * @since 2018.07 |
||
538 | * @category Developer |
||
539 | * @see mshop/customer/manager/property/type/standard/insert/ansi |
||
540 | * @see mshop/customer/manager/property/type/standard/update/ansi |
||
541 | * @see mshop/customer/manager/property/type/standard/newid/ansi |
||
542 | * @see mshop/customer/manager/property/type/standard/delete/ansi |
||
543 | * @see mshop/customer/manager/property/type/standard/search/ansi |
||
544 | */ |
||
545 | |||
546 | return 'mshop/customer/manager/property/type/standard/'; |
||
547 | } |
||
548 | |||
559 | } |