| @@ 579-614 (lines=36) @@ | ||
| 576 | $count = 0; |
|
| 577 | $RecordClass = get_class($this->BO); |
|
| 578 | ||
| 579 | while ($row = $result->fetchArray(SQLITE3_ASSOC)) { |
|
| 580 | try { |
|
| 581 | $argsCount = count($constructorArgs); |
|
| 582 | ||
| 583 | if ($argsCount < 1) { |
|
| 584 | $obj = new $RecordClass(); |
|
| 585 | } else { |
|
| 586 | switch ($argsCount) { |
|
| 587 | case 1: |
|
| 588 | $obj = new $RecordClass($constructorArgs[0]); |
|
| 589 | break; |
|
| 590 | case 2: |
|
| 591 | $obj = new $RecordClass($constructorArgs[0], $constructorArgs[1]); |
|
| 592 | break; |
|
| 593 | case 3: |
|
| 594 | $obj = new $RecordClass($constructorArgs[0], $constructorArgs[1], $constructorArgs[2]); |
|
| 595 | break; |
|
| 596 | case 4: |
|
| 597 | $obj = new $RecordClass($constructorArgs[0], $constructorArgs[1], $constructorArgs[2], $constructorArgs[3]); |
|
| 598 | break; |
|
| 599 | case 5: |
|
| 600 | $obj = new $RecordClass($constructorArgs[0], $constructorArgs[1], $constructorArgs[2], $constructorArgs[3], $constructorArgs[4]); |
|
| 601 | break; |
|
| 602 | default: |
|
| 603 | throw new IllegalArguementException('Too many elements in the $constructorArgs array passed to the loadAllByAttribute method!'); |
|
| 604 | break; |
|
| 605 | } |
|
| 606 | } |
|
| 607 | ||
| 608 | $obj->load($row['OID']); |
|
| 609 | $objects[$count] = $obj; |
|
| 610 | ++$count; |
|
| 611 | } catch (ResourceNotAllowedException $e) { |
|
| 612 | // the resource not allowed will be absent from the list |
|
| 613 | } |
|
| 614 | } |
|
| 615 | ||
| 616 | $stmt->close(); |
|
| 617 | } else { |
|
| @@ 712-747 (lines=36) @@ | ||
| 709 | $count = 0; |
|
| 710 | $RecordClass = get_class($this->BO); |
|
| 711 | ||
| 712 | while ($row = $result->fetchArray(SQLITE3_ASSOC)) { |
|
| 713 | try { |
|
| 714 | $argsCount = count($constructorArgs); |
|
| 715 | ||
| 716 | if ($argsCount < 1) { |
|
| 717 | $obj = new $RecordClass(); |
|
| 718 | } else { |
|
| 719 | switch ($argsCount) { |
|
| 720 | case 1: |
|
| 721 | $obj = new $RecordClass($constructorArgs[0]); |
|
| 722 | break; |
|
| 723 | case 2: |
|
| 724 | $obj = new $RecordClass($constructorArgs[0], $constructorArgs[1]); |
|
| 725 | break; |
|
| 726 | case 3: |
|
| 727 | $obj = new $RecordClass($constructorArgs[0], $constructorArgs[1], $constructorArgs[2]); |
|
| 728 | break; |
|
| 729 | case 4: |
|
| 730 | $obj = new $RecordClass($constructorArgs[0], $constructorArgs[1], $constructorArgs[2], $constructorArgs[3]); |
|
| 731 | break; |
|
| 732 | case 5: |
|
| 733 | $obj = new $RecordClass($constructorArgs[0], $constructorArgs[1], $constructorArgs[2], $constructorArgs[3], $constructorArgs[4]); |
|
| 734 | break; |
|
| 735 | default: |
|
| 736 | throw new IllegalArguementException('Too many elements in the $constructorArgs array passed to the loadAllByAttribute method!'); |
|
| 737 | break; |
|
| 738 | } |
|
| 739 | } |
|
| 740 | ||
| 741 | $obj->load($row['OID']); |
|
| 742 | $objects[$count] = $obj; |
|
| 743 | ++$count; |
|
| 744 | } catch (ResourceNotAllowedException $e) { |
|
| 745 | // the resource not allowed will be absent from the list |
|
| 746 | } |
|
| 747 | } |
|
| 748 | ||
| 749 | $stmt->close(); |
|
| 750 | ||