diff --git a/includes/class-QueryConference.php b/includes/class-QueryConference.php index 5f9df35..7465cec 100644 --- a/includes/class-QueryConference.php +++ b/includes/class-QueryConference.php @@ -1,133 +1,143 @@ . /** * Class able to query a Conference */ trait QueryConferenceTrait { /* * Univoque Location ID column name * * Used from ConferenceTrait. * * @var */ protected $LOCATION_ID = 'conference.location_ID'; /** * Limit to a specific Conference * * @param $conference Conference * @return self */ public function whereConference( $conference ) { - return $this->whereInt( $this->CONFERENCE_ID, $conference->getConferenceID() ); + return $this->whereConferenceID( $conference->getConferenceID() ); + } + + /** + * Limit to a specific Conference ID + * + * @param $id Conference ID + * @return self + */ + public function whereConferenceID( $id ) { + return $this->whereInt( $this->CONFERENCE_ID, $id ); } /** * Exclude a specific Conference * * @param $conference Conference * @return self */ public function whereConferenceNot( $conference ) { $id = $conference->getConferenceID(); return $this->joinConference() ->whereInt( Event::CONFERENCE_, $id, '<>' ); } /** * Where the Conference UID is... * * @param string $uid Conference UID * @return self */ public function whereConferenceUID( $uid ) { return $this->whereStr( Conference::UID, $uid ); } /** * Join a table to the Conference table * * You can call it multiple time safely. * * @return self */ public function joinConference() { if( empty( $this->joinedConference ) ) { $this->joinOn( 'INNER', Conference::T, Conference::ID_, $this->CONFERENCE_ID ); $this->joinedConference = true; } return $this; } /** * Join Events to their Location (and Conference. asd) * * You can call it multiple time safely. * * @return self */ public function joinLocation() { if( empty( $this->joinedLocation ) ) { $this->joinOn( 'INNER', Location::T, $this->LOCATION_ID, 'location.location_ID' ); $this->joinedLocation = true; } return $this; } /** * Check if the Conference has support for internationalization * * @return self */ public function whereConferenceHasI18nSupport() { return $this->compare( 'conference_events_url', 'IS NOT', 'NULL' ); } } /** * Conference */ class QueryConference extends Query { use QueryConferenceTrait; /* * Univoque Conference ID column name * * Used from ConferenceTrait. * * @var */ protected $CONFERENCE_ID = 'conference.conference_ID'; /** * Constructor */ public function __construct( $db = null ) { // set database connection and default result class parent::__construct( $db, Conference::class ); // set the default table $this->from( Conference::T ); } }