| @@ 756-796 (lines=41) @@ | ||
| 753 | * |
|
| 754 | * @see Alpha\Model\ActiveRecordProviderInterface::loadAllByDayUpdated() |
|
| 755 | */ |
|
| 756 | public function loadAllByDayUpdated($date, $start = 0, $limit = 0, $orderBy = 'OID', $order = 'ASC', $ignoreClassType = false) |
|
| 757 | { |
|
| 758 | self::$logger->debug('>>loadAllByDayUpdated(date=['.$date.'], start=['.$start.'], limit=['.$limit.'], orderBy=['.$orderBy.'], order=['.$order.'], ignoreClassType=['.$ignoreClassType.']'); |
|
| 759 | ||
| 760 | if ($start != 0 && $limit != 0) { |
|
| 761 | $limit = ' LIMIT '.$start.', '.$limit.';'; |
|
| 762 | } else { |
|
| 763 | $limit = ';'; |
|
| 764 | } |
|
| 765 | ||
| 766 | if (!$ignoreClassType && $this->BO->isTableOverloaded()) { |
|
| 767 | $sqlQuery = 'SELECT OID FROM '.$this->BO->getTableName()." WHERE updated_ts >= '".$date." 00:00:00' AND updated_ts <= '".$date." 23:59:59' AND classname = '".get_class($this->BO)."' ORDER BY ".$orderBy.' '.$order.$limit; |
|
| 768 | } else { |
|
| 769 | $sqlQuery = 'SELECT OID FROM '.$this->BO->getTableName()." WHERE updated_ts >= '".$date." 00:00:00' AND updated_ts <= '".$date." 23:59:59' ORDER BY ".$orderBy.' '.$order.$limit; |
|
| 770 | } |
|
| 771 | ||
| 772 | $this->BO->setLastQuery($sqlQuery); |
|
| 773 | ||
| 774 | if (!$result = self::getConnection()->query($sqlQuery)) { |
|
| 775 | throw new RecordNotFoundException('Failed to load object OIDs, MySql error is ['.self::getConnection()->error.'], query ['.$this->BO->getLastQuery().']'); |
|
| 776 | self::$logger->debug('<<loadAllByDayUpdated []'); |
|
| 777 | ||
| 778 | return array(); |
|
| 779 | } |
|
| 780 | ||
| 781 | // now build an array of objects to be returned |
|
| 782 | $objects = array(); |
|
| 783 | $count = 0; |
|
| 784 | $RecordClass = get_class($this->BO); |
|
| 785 | ||
| 786 | while ($row = $result->fetch_array(MYSQLI_ASSOC)) { |
|
| 787 | $obj = new $RecordClass(); |
|
| 788 | $obj->load($row['OID']); |
|
| 789 | $objects[$count] = $obj; |
|
| 790 | ++$count; |
|
| 791 | } |
|
| 792 | ||
| 793 | self::$logger->debug('<<loadAllByDayUpdated ['.count($objects).']'); |
|
| 794 | ||
| 795 | return $objects; |
|
| 796 | } |
|
| 797 | ||
| 798 | /** |
|
| 799 | * (non-PHPdoc). |
|
| @@ 761-801 (lines=41) @@ | ||
| 758 | * |
|
| 759 | * @see Alpha\Model\ActiveRecordProviderInterface::loadAllByDayUpdated() |
|
| 760 | */ |
|
| 761 | public function loadAllByDayUpdated($date, $start = 0, $limit = 0, $orderBy = 'OID', $order = 'ASC', $ignoreClassType = false) |
|
| 762 | { |
|
| 763 | self::$logger->debug('>>loadAllByDayUpdated(date=['.$date.'], start=['.$start.'], limit=['.$limit.'], orderBy=['.$orderBy.'], order=['.$order.'], ignoreClassType=['.$ignoreClassType.']'); |
|
| 764 | ||
| 765 | if ($start != 0 && $limit != 0) { |
|
| 766 | $limit = ' LIMIT '.$limit.' OFFSET '.$start.';'; |
|
| 767 | } else { |
|
| 768 | $limit = ';'; |
|
| 769 | } |
|
| 770 | ||
| 771 | if (!$ignoreClassType && $this->BO->isTableOverloaded()) { |
|
| 772 | $sqlQuery = 'SELECT OID FROM '.$this->BO->getTableName()." WHERE updated_ts >= '".$date." 00:00:00' AND updated_ts <= '".$date." 23:59:59' AND classname = '".get_class($this->BO)."' ORDER BY ".$orderBy.' '.$order.$limit; |
|
| 773 | } else { |
|
| 774 | $sqlQuery = 'SELECT OID FROM '.$this->BO->getTableName()." WHERE updated_ts >= '".$date." 00:00:00' AND updated_ts <= '".$date." 23:59:59' ORDER BY ".$orderBy.' '.$order.$limit; |
|
| 775 | } |
|
| 776 | ||
| 777 | $this->BO->setLastQuery($sqlQuery); |
|
| 778 | ||
| 779 | if (!$result = self::getConnection()->query($sqlQuery)) { |
|
| 780 | throw new RecordNotFoundException('Failed to load object OIDs, SQLite error is ['.self::getLastDatabaseError().'], query ['.$this->BO->getLastQuery().']'); |
|
| 781 | self::$logger->debug('<<loadAllByDayUpdated []'); |
|
| 782 | ||
| 783 | return array(); |
|
| 784 | } |
|
| 785 | ||
| 786 | // now build an array of objects to be returned |
|
| 787 | $objects = array(); |
|
| 788 | $count = 0; |
|
| 789 | $RecordClass = get_class($this->BO); |
|
| 790 | ||
| 791 | while ($row = $result->fetchArray()) { |
|
| 792 | $obj = new $RecordClass(); |
|
| 793 | $obj->load($row['OID']); |
|
| 794 | $objects[$count] = $obj; |
|
| 795 | ++$count; |
|
| 796 | } |
|
| 797 | ||
| 798 | self::$logger->debug('<<loadAllByDayUpdated ['.count($objects).']'); |
|
| 799 | ||
| 800 | return $objects; |
|
| 801 | } |
|
| 802 | ||
| 803 | /** |
|
| 804 | * (non-PHPdoc). |
|