Created
November 9, 2012 08:44
-
-
Save noelboss/4044511 to your computer and use it in GitHub Desktop.
Revisions
-
noelboss revised this gist
Nov 9, 2012 . 3 changed files with 39 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ /** * * * @package nboevents * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later * */ class Tx_Nboevents_Domain_Repository_EventRepository extends Tx_Extbase_Persistence_Repository { /** * defaultOrderings * * @var array */ protected $defaultOrderings = array( 'date' => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING, ); /** * findByCourse * * @param $uid * @return */ public function findByCourse($course = 0, $limit = 99) { $now = time(); $query = $this->createQuery(); $query->matching( $query->logicalAnd( $query->equals('course', $course), $query->greaterThanOrEqual('date', $now) ) ); $query->setLimit((integer)$limit); $posts = $query->execute(); return $posts; } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ /** * Returns the events * This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +0,0 @@ -
noelboss revised this gist
Nov 9, 2012 . 2 changed files with 8 additions and 38 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ /** * Returns the events * * @return Tx_Extbase_Persistence_ObjectStorage<Tx_Nboevents_Domain_Model_Event> $events */ public function getEvents() { $this->events; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,38 +0,0 @@ -
noelboss created this gist
Nov 9, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ /** * Returns the events * * @return Tx_Extbase_Persistence_ObjectStorage<Tx_Nboevents_Domain_Model_Event> $events */ public function getEvents() { $eventRepository = t3lib_div::makeInstance('Tx_Nboevents_Domain_Repository_EventRepository'); return $eventRepository->findByCourse($this->getUid()); } /** * Returns the next event * * @return Tx_Extbase_Persistence_ObjectStorage<Tx_Nboevents_Domain_Model_Event> $events */ public function getNextevent() { $eventRepository = t3lib_div::makeInstance('Tx_Nboevents_Domain_Repository_EventRepository'); return $eventRepository->findByCourse($this->getUid(), 1); } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ /** * * * @package nboevents * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later * */ class Tx_Nboevents_Domain_Repository_EventRepository extends Tx_Extbase_Persistence_Repository { /** * defaultOrderings * * @var array */ protected $defaultOrderings = array( 'date' => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING, ); /** * findByCourse * * @param $uid * @return */ public function findByCourse($course = 0, $limit = 99) { $now = time(); $query = $this->createQuery(); $query->matching( $query->logicalAnd( $query->equals('course', $course), $query->greaterThanOrEqual('date', $now) ) ); $query->setLimit((integer)$limit); $posts = $query->execute(); return $posts; } }