Esempio n. 1
0
 /**
  * Retrieve select object for load object data
  *
  * @param string $field
  * @param mixed $value
  * @param AbstractModel $object
  * @return Select
  */
 protected function _getLoadSelect($field, $value, $object)
 {
     $select = parent::_getLoadSelect($field, $value, $object);
     $websiteId = (int) $object->getWebsite()->getId();
     if ($websiteId) {
         $connection = $this->getConnection();
         $columns = [];
         $scopeTable = $this->_getEavWebsiteTable();
         $describe = $connection->describeTable($scopeTable);
         unset($describe['attribute_id']);
         foreach (array_keys($describe) as $columnName) {
             $columns['scope_' . $columnName] = $columnName;
         }
         $conditionSql = $connection->quoteInto($this->getMainTable() . '.attribute_id = scope_table.attribute_id AND scope_table.website_id =?', $websiteId);
         $select->joinLeft(['scope_table' => $scopeTable], $conditionSql, $columns);
     }
     return $select;
 }