/** * Initialize a new user filter on an active record. * * @param Phprojekt_ActiveRecord_Abstract $record An active record. * @param string $where The internal where clause. * * @return void */ public function __construct(Phprojekt_ActiveRecord_Abstract $record, $where = null) { $this->_info = $record->info(); $this->_cols = $this->_info['cols']; $this->_where = $where; $this->_record = $record; }
/** * Initialize a new user filter on an active record. * It uses the table name and the database adapter from the Active Record. * * @param Phprojekt_ActiveRecord_Abstract $record An active record. * @param string $identifier The identifier usually the column to filter. * @param mixed $value The value to filter. * * @return void */ public function __construct(Phprojekt_ActiveRecord_Abstract $record, $identifier, $value) { $info = $record->info(); $cols = $info['cols']; $identifier = Phprojekt_ActiveRecord_Abstract::convertVarToSql($identifier); if (!in_array($identifier, $cols)) { throw new InvalidArgumentException('Identifier not found'); } $this->_identifier = $identifier; $this->_value = $value; parent::__construct($record->getAdapter()); }