当前位置: 首页>>代码示例>>PHP>>正文


PHP AdapterInterface::fetchRow方法代码示例

本文整理汇总了PHP中Magento\Framework\DB\Adapter\AdapterInterface::fetchRow方法的典型用法代码示例。如果您正苦于以下问题:PHP AdapterInterface::fetchRow方法的具体用法?PHP AdapterInterface::fetchRow怎么用?PHP AdapterInterface::fetchRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\DB\Adapter\AdapterInterface的用法示例。


在下文中一共展示了AdapterInterface::fetchRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testAggregate

 /**
  * @magentoDataFixture Magento/Review/_files/customer_review_with_rating.php
  */
 public function testAggregate()
 {
     $rating = $this->reviewCollection->getFirstItem();
     $this->reviewResource->aggregate($rating);
     $select = $this->adapter->select()->from($this->resource->getTableName('review_entity_summary'));
     $result = $this->adapter->fetchRow($select);
     $this->assertEquals(1, $result['reviews_count']);
     $this->assertEquals(40, $result['rating_summary']);
 }
开发者ID:nja78,项目名称:magento2,代码行数:12,代码来源:ReviewTest.php

示例2: getAggregations

 /**
  * {@inheritdoc}
  */
 public function getAggregations(\Magento\Framework\Search\Dynamic\EntityStorage $entityStorage)
 {
     $aggregation = ['count' => 'count(DISTINCT main_table.entity_id)', 'max' => 'MAX(min_price)', 'min' => 'MIN(min_price)', 'std' => 'STDDEV_SAMP(min_price)'];
     $select = $this->getSelect();
     $tableName = $this->resource->getTableName('catalog_product_index_price');
     /** @var Table $table */
     $table = $entityStorage->getSource();
     $select->from(['main_table' => $tableName], [])->joinInner(['entities' => $table->getName()], 'main_table.entity_id  = entities.entity_id', [])->columns($aggregation);
     $select = $this->setCustomerGroupId($select);
     $result = $this->connection->fetchRow($select);
     return $result;
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:15,代码来源:DataProvider.php

示例3: getByOdooId

 /** @inheritdoc */
 public function getByOdooId($odooId)
 {
     /** @var  $result AggWarehouse */
     $result = null;
     $query = $this->_factorySelect->getQueryToSelect();
     $query->where(static::AS_ODOO . '.' . EntityWarehouse::ATTR_ODOO_REF . '=:id');
     $data = $this->_conn->fetchRow($query, ['id' => $odooId]);
     if ($data) {
         $result = $this->_manObj->create(AggWarehouse::class);
         $result->setData($data);
     }
     return $result;
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_odoo,代码行数:14,代码来源:Warehouse.php

示例4: testInsertForce

 /**
  * @dataProvider insertDataProvider
  */
 public function testInsertForce($data)
 {
     $this->assertEquals(1, $this->_connection->insertForce($this->_tableName, $data));
     $select = $this->_connection->select()->from($this->_tableName);
     $result = $this->_connection->fetchRow($select);
     $this->assertEquals($data, $result);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:10,代码来源:InterfaceTest.php

示例5: loadNode

 /**
  * @param mixed $nodeId
  * @return Node
  */
 public function loadNode($nodeId)
 {
     $select = clone $this->_select;
     $condition = $this->_conn->quoteInto("{$this->_table}.{$this->_idField}=?", $nodeId);
     $select->where($condition);
     $node = new Node($this->_conn->fetchRow($select), $this->_idField, $this);
     $this->addNode($node);
     return $node;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:Db.php

示例6: getNode

 /**
  * @param string|int $nodeId
  * @return Node
  */
 public function getNode($nodeId)
 {
     $dbSelect = new Select($this->_db);
     $dbSelect->from($this->_table)->where($this->_table . '.' . $this->_id . ' >= :id');
     $this->_addExtTablesToSelect($dbSelect);
     $data = [];
     $data['id'] = $nodeId;
     $data = $this->_db->fetchRow($dbSelect, $data);
     return new Node($data, $this->getKeys());
 }
开发者ID:IlyaGluschenko,项目名称:test001,代码行数:14,代码来源:Tree.php

示例7: testWriteEncoded

 /**
  * Assert that session data writes to DB in base64 encoding
  */
 public function testWriteEncoded()
 {
     $data = serialize($this->_sessionData[self::SESSION_NEW]);
     $this->_model->write(self::SESSION_ID, $data);
     $select = $this->_connection->select()->from($this->_sessionTable)->where(self::COLUMN_SESSION_ID . ' = :' . self::COLUMN_SESSION_ID);
     $bind = [self::COLUMN_SESSION_ID => self::SESSION_ID];
     $session = $this->_connection->fetchRow($select, $bind);
     $this->assertEquals(self::SESSION_ID, $session[self::COLUMN_SESSION_ID]);
     $this->assertTrue(ctype_digit((string) $session[self::COLUMN_SESSION_EXPIRES]), 'Value of session expire field must have integer type');
     $this->assertEquals($data, base64_decode($session[self::COLUMN_SESSION_DATA]));
 }
开发者ID:vasiljok,项目名称:magento2,代码行数:14,代码来源:DbTableTest.php

示例8: loadNode

 /**
  * Load node
  *
  * @param int|string $nodeId
  * @return Node
  */
 public function loadNode($nodeId)
 {
     $select = clone $this->_select;
     if (is_numeric($nodeId)) {
         $condField = $this->_conn->quoteIdentifier([$this->_table, $this->_idField]);
     } else {
         $condField = $this->_conn->quoteIdentifier([$this->_table, $this->_pathField]);
     }
     $select->where("{$condField} = ?", $nodeId);
     $node = new Node($this->_conn->fetchRow($select), $this->_idField, $this);
     $this->addNode($node);
     return $node;
 }
开发者ID:IlyaGluschenko,项目名称:test001,代码行数:19,代码来源:Dbp.php

示例9: getVersion

 /**
  * Get maximum version_id from changelog
  *
  * @return int
  * @throws \Exception
  */
 public function getVersion()
 {
     $changelogTableName = $this->resource->getTableName($this->getName());
     if (!$this->connection->isTableExists($changelogTableName)) {
         throw new \Exception("Table {$changelogTableName} does not exist");
     }
     $row = $this->connection->fetchRow('SHOW TABLE STATUS LIKE ?', [$changelogTableName]);
     if (isset($row['Auto_increment'])) {
         return (int) $row['Auto_increment'] - 1;
     } else {
         throw new \Exception("Table status for `{$changelogTableName}` is incorrect. Can`t fetch version id.");
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:19,代码来源:Changelog.php

示例10: getById

 /**
  * @inheritdoc
  *
  * @SuppressWarnings(PHPMD.ShortVariable)
  */
 public function getById($id)
 {
     /** @var  $result AggWarehouse */
     $result = null;
     $query = $this->_factorySelect->getQueryToSelect();
     $query->where(static::AS_STOCK . '.' . Cfg::E_CATINV_STOCK_A_STOCK_ID . '=:id');
     $data = $this->_conn->fetchRow($query, ['id' => $id]);
     if ($data) {
         $result = $this->_manObj->create(AggLot::class);
         $result->setData($data);
     }
     return $result;
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_warehouse,代码行数:18,代码来源:Warehouse.php

示例11: loadByCustomerData

 /**
  * Load subscriber by customer
  *
  * @param \Magento\Customer\Api\Data\CustomerInterface $customer
  * @return array
  */
 public function loadByCustomerData(\Magento\Customer\Api\Data\CustomerInterface $customer)
 {
     $select = $this->connection->select()->from($this->getMainTable())->where('customer_id=:customer_id');
     $result = $this->connection->fetchRow($select, ['customer_id' => $customer->getId()]);
     if ($result) {
         return $result;
     }
     $select = $this->connection->select()->from($this->getMainTable())->where('subscriber_email=:subscriber_email');
     $result = $this->connection->fetchRow($select, ['subscriber_email' => $customer->getEmail()]);
     if ($result) {
         return $result;
     }
     return [];
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:20,代码来源:Subscriber.php

示例12: getTableStatus

 /**
  * Retrieve table status
  *
  * @param string $tableName
  * @return \Magento\Framework\DataObject|bool
  */
 public function getTableStatus($tableName)
 {
     $row = $this->connection->showTableStatus($tableName);
     if ($row) {
         $statusObject = new \Magento\Framework\DataObject();
         foreach ($row as $field => $value) {
             $statusObject->setData(strtolower($field), $value);
         }
         $cntRow = $this->connection->fetchRow($this->connection->select()->from($tableName, 'COUNT(1) as rows'));
         $statusObject->setRows($cntRow['rows']);
         return $statusObject;
     }
     return false;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:20,代码来源:Db.php

示例13: getByOdooId

 /** @inheritdoc */
 public function getByOdooId($id)
 {
     $result = null;
     if (is_null($id)) {
         $this->_checkNullLot();
     }
     $query = $this->_factorySelect->getQueryToSelect();
     $where = static::AS_ODOO . '.' . EntityLot::ATTR_ODOO_REF . '=:id';
     $query->where($where);
     $data = $this->_conn->fetchRow($query, ['id' => $id]);
     if ($data) {
         /** @var  $result AggLot */
         $result = $this->_manObj->create(AggLot::class);
         $result->setData($data);
     }
     return $result;
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_odoo,代码行数:18,代码来源:Lot.php

示例14: doFindByFilter

 /**
  * {@inheritdoc}
  */
 protected function doFindByFilter($filter)
 {
     return $this->connection->fetchRow($this->prepareSelect($filter));
 }
开发者ID:aiesh,项目名称:magento2,代码行数:7,代码来源:Db.php

示例15: doFindOneByData

 /**
  * {@inheritdoc}
  */
 protected function doFindOneByData($data)
 {
     return $this->connection->fetchRow($this->prepareSelect($data));
 }
开发者ID:vasiljok,项目名称:magento2,代码行数:7,代码来源:DbStorage.php


注:本文中的Magento\Framework\DB\Adapter\AdapterInterface::fetchRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。