/** * Check if binder has the specified binding * * @param string $name * @return boolean */ public function hasBinding($name) { if ($this->_select) { return $this->_select->hasBinding($name); } return false; }
protected function _prepareQuery(Mzax_Emarketing_Db_Select $query) { $condition = $this->getDataSetDefault('condition', self::DEFAULT_CONDITION); $status = $this->getDataSetDefault('status', self::DEFAULT_STATUS); if (!$query->hasBinding('subscriber_status')) { if ($query->hasBinding('subscriber_id')) { $query->joinTableLeft('subscriber_id', 'newsletter/subscriber', 'subscriber'); } else { if ($query->hasBinding('customer_id')) { $query->joinTableLeft('customer_id', 'newsletter/subscriber', 'subscriber'); } } $query->addBinding('subscriber_status', 'subscriber.subscriber_status'); } $condition = $condition === 'is' ? '=' : '!='; $query->where("{subscriber_status} {$condition} ?", $status); }
/** * Apply the incremental day look back on the date_filter expression * * @param Mzax_Emarketing_Db_Select $select * @param string $lastRecord */ protected function applyDateFilter(Mzax_Emarketing_Db_Select $select, $lastRecord = null) { $incremental = $this->getOption('incremental'); if ($incremental && !$this->getOption('full')) { if ($lastRecord === null) { $lastRecord = $this->getLastRecordTime(); } if ($lastRecord && $select->hasBinding('date_filter')) { $select->where("{date_filter} >= {$this->getIncrementalSql()}", $lastRecord); } } }