_primaryKey || !is_array($fieldValues) || empty($fieldValues) || sizeof($additionalFields) != sizeof($additionalValues) ) { return false; } if (is_array($this->_primaryKey)) { throw new Qs_Db_Obj_Exception(__METHOD__ . ' does not support complex primary keys'); } if ($needUpdate) { $this->_deleteIds($tableAlias, $referenceField); } $fields = array_merge(array($referenceField, $fieldName), $additionalFields); $valueParts = array(); foreach ($fieldValues as $referenceId) { $values = array_merge(array($this->_primaryKey, $referenceId), $additionalValues); $values = array_map(array($this->_db, 'quote'), $values); $valueParts[] = '(' . implode(', ', $values). ')'; } $sql = 'INSERT INTO ' . $this->_getQuotedTableName($tableAlias) . ' (`' . implode('`, `', $fields) . '`) VALUES ' . PHP_EOL . implode(', ' . PHP_EOL, $valueParts) . ';'; return $this->_db->query($sql)->rowCount(); } protected function _filter(\Zend_Db_Select $select) { $select->where('`' . $this->_tableAlias . '`.`type` = ?', $this->_adminType); return parent::_filter($select); } }