/** * Augment the provided Select object with all the EAV attribute values from this * definition. * * @param Select $select * @return Select * @throws Select */ public function augmentSelect(Select $select) { $db = $this->table->getAdapter(); $id = current($this->table->getPrimaryKey()); $rootTableAlias = $select->quoteWithAlias($this->table->getTableName(), $id); foreach ($this->getAttributes() as $attribute) { $alias = 'eav_' . $attribute['attribute_id']; $table = $this->table->getTableName() . $this->valueTablePrefix . $attribute['backend_type']; $select->joinLeft([$alias => $table], $db->quoteInto("{$alias}.{$id} = {$rootTableAlias} AND {$alias}.attribute_id = ?", $attribute['attribute_id']), [$alias => 'value']); } return $select; }