本文整理汇总了PHP中Zend\Db\ResultSet\ResultSet::current方法的典型用法代码示例。如果您正苦于以下问题:PHP ResultSet::current方法的具体用法?PHP ResultSet::current怎么用?PHP ResultSet::current使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Db\ResultSet\ResultSet
的用法示例。
在下文中一共展示了ResultSet::current方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getService
/**
* Get service
*
* @return string|boolean
*/
public function getService()
{
$select = $this->select();
$select->from('application_delete_content_service')->columns(['id', 'path'])->limit(1)->order('processed asc')->order('id asc');
$statement = $this->prepareStatementForSqlObject($select);
$resultSet = new ResultSet();
$resultSet->initialize($statement->execute());
if (!empty($resultSet->current())) {
if (true === ($result = $this->markServiceProcessed($resultSet->current()['id']))) {
return $resultSet->current()['path'];
}
}
return false;
}
示例2: getCommentsCount
/**
* Get comments count
*
* @param boolean $allowApprove
* @param integer $pageId
* @param string $pageSlug
* @param integer $lastRightKey
* @return integer
*/
public function getCommentsCount($allowApprove, $pageId, $pageSlug = null, $lastRightKey = null)
{
$select = $this->select();
$select->from('comment_list')->columns(['comments_count' => new Expression('COUNT(*)')])->where(['page_id' => $pageId, 'slug' => $pageSlug]);
if (!$allowApprove) {
$select->where(['hidden' => CommentNestedSet::COMMENT_STATUS_NOT_HIDDEN]);
}
if ($lastRightKey) {
$select->where->lessThan($this->getCommentModel()->getRightKey(), $lastRightKey);
}
$statement = $this->prepareStatementForSqlObject($select);
$resultSet = new ResultSet();
$resultSet->initialize($statement->execute());
return !empty($resultSet->current()->comments_count) ? $resultSet->current()->comments_count : 0;
}
示例3: testCallingBufferAfterIterationThrowsException
public function testCallingBufferAfterIterationThrowsException()
{
$this->resultSet->initialize($this->getMock('Zend\\Db\\Adapter\\Driver\\ResultInterface'));
$this->resultSet->current();
$this->setExpectedException('Zend\\Db\\ResultSet\\Exception\\RuntimeException', 'Buffering must be enabled before iteration is started');
$this->resultSet->buffer();
}
示例4: checkActivationCode
/**
* Check activation code
*
* @param integer $userId
* @param string $activationCode
* @return boolean
*/
public function checkActivationCode($userId, $activationCode)
{
$select = $this->select();
$select->from('user_list')->columns(['user_id'])->where(['user_id' => $userId, 'activation_code' => $activationCode]);
$statement = $this->prepareStatementForSqlObject($select);
$resultSet = new ResultSet();
$resultSet->initialize($statement->execute());
return $resultSet->current() ? true : false;
}
示例5: isAnswerVoteExist
/**
* Is answer vote exist
*
* @param integer $questionId
* @return boolean
*/
public function isAnswerVoteExist($questionId)
{
$remote = new RemoteAddress();
$remote->setUseProxy(true);
$select = $this->select();
$select->from('poll_answer_track')->columns(['id'])->where(['question_id' => $questionId, 'ip' => inet_pton($remote->getIpAddress())]);
$statement = $this->prepareStatementForSqlObject($select);
$resultSet = new ResultSet();
$resultSet->initialize($statement->execute());
return !empty($resultSet->current());
}
示例6: isQuestionFree
/**
* Is question free
*
* @param string $question
* @param integer $questionId
* @return boolean
*/
public function isQuestionFree($question, $questionId = 0)
{
$select = $this->select();
$select->from('poll_question')->columns(['id'])->where(['question' => $question, 'language' => $this->getCurrentLanguage()]);
if ($questionId) {
$select->where([new NotInPredicate('id', [$questionId])]);
}
$statement = $this->prepareStatementForSqlObject($select);
$resultSet = new ResultSet();
$resultSet->initialize($statement->execute());
return $resultSet->current() ? false : true;
}
示例7: isRoleNameFree
/**
* Is a role's name free
*
* @param string $roleName
* @param integer $roleId
* @return boolean
*/
public function isRoleNameFree($roleName, $roleId = 0)
{
$select = $this->select();
$select->from('acl_role')->columns(['id'])->where(['name' => $roleName]);
if ($roleId) {
$select->where([new NotInPredicate('id', [$roleId])]);
}
$statement = $this->prepareStatementForSqlObject($select);
$resultSet = new ResultSet();
$resultSet->initialize($statement->execute());
return $resultSet->current() ? false : true;
}
示例8: getProductJoinedRow
/**
* Get joined product
*
* @param int $id product id
* @return ProductJoinedRow
* @throws Exception\InvalidArgumentException
*/
public function getProductJoinedRow($id)
{
$id = (int) $id;
$pt = $this->getJoinedTable('ProductTable')->getTable();
$pdt = $this->getJoinedTable('ProductDescriptionTable')->getTable();
$select = $this->sql->select()->from("{$pt}")->columns(array("*"))->join($pdt, "{$pt}.product_id = {$pdt}.product_id", array('description_id', 'description'), Select::JOIN_LEFT)->order("{$pt}.product_id DESC")->where("{$pt}.product_id = {$id}");
$statement = $this->sql->prepareStatementForSqlObject($select);
$resultSet = new ResultSet(ResultSet::TYPE_ARRAYOBJECT, new ProductJoinedRow());
$resultSet->initialize($statement->execute());
if (!$resultSet->count()) {
throw new Exception\InvalidArgumentException("Not found joined product: {$id}");
}
return $resultSet->current();
}
示例9: current
/**
* Iterator: get current item
*
* @throws Exception\LogicException whenever a record cannot be instanciated, due to missing column specs
* @return Record
*/
public function current()
{
$data = $this->dataSource->current();
if (!$this->has_complete_record_definition) {
$data_columns = array_keys($this->table->getColumnsInformation());
$record_columns = array_keys((array) $data);
$matches = array_intersect($data_columns, $record_columns);
if (count($matches) != count($data_columns)) {
$missings = join(',', array_diff($data_columns, $record_columns));
$msg = __METHOD__ . ": Cannot create a Record due to incomplete or aliased column definition (missing: {$missings}).";
$msg .= "Check whether columns have been modified in TableSearch::columns() method, or use an toArray(), toJson()... version of the ResultSet.";
throw new Exception\LogicException($msg);
}
$this->has_complete_record_definition = true;
}
$record = $this->table->record($data, $ignore = true);
$record->setState(Record::STATE_CLEAN);
return $record;
}
示例10: get_last_periodic_transaction
public function get_last_periodic_transaction(Item $item, $features)
{
$sql = $this->tableGateway->getSql();
$select = $this->tableGateway->getSql()->select();
$select->where($features);
$select->order('accured_time DESC');
$statement = $sql->prepareStatementForSqlObject($select);
$results = $statement->execute();
$rowset = new ResultSet();
$rowset->initialize($results);
$row = $rowset->current();
if (!$row) {
// throw new \Exception("Could not find row $id");
}
return $row;
// $row = array();
// if (!empty($rowset))
// $row = $rowset[sizeof($rowset)-1];
// return $row;
}
示例11: isValid
public function isValid($username, $password)
{
$sql = $this->getObjDbSql();
$select = $sql->select();
$select->columns(array('u_kode', 'u_nama', 'u_kode_fungsional', 'u_gelar_diplomatik', 'u_urutan', 'u_password'));
$select->from($this->table);
$select->where(array("u_status=1", "u_nama = '{$username}' "));
$statement = $sql->prepareStatementForSqlObject($select);
$result = $statement->execute();
$resultSet = new ResultSet();
$resultSet->initialize($result);
//return $resultSet->toArray();
$user = $resultSet->current();
if (!$user) {
return false;
}
//
if (md5($password) == $user['u_password']) {
return $user;
} else {
return false;
}
}
示例12: isCategoryFree
/**
* Is a category free
*
* @param string $categoryName
* @param integer $categoryId
* @return boolean
*/
public function isCategoryFree($categoryName, $categoryId = 0)
{
$select = $this->select();
$select->from('miniphotogallery_category')->columns(['id'])->where(['name' => $categoryName, 'language' => $this->getCurrentLanguage()]);
if ($categoryId) {
$select->where([new NotInPredicate('id', [$categoryId])]);
}
$statement = $this->prepareStatementForSqlObject($select);
$resultSet = new ResultSet();
$resultSet->initialize($statement->execute());
return $resultSet->current() ? false : true;
}
开发者ID:esase,项目名称:dream-cms-mini-photo-gallery-module,代码行数:19,代码来源:MiniPhotoGalleryAdministration.php
示例13: fetchRow
/**
* Get one row of table for given $query
*
* @param \Zend\Db\Sql\Select $query
* @param
* string | $prototypeClass
* @return mixed
*/
public function fetchRow(\Zend\Db\Sql\Select $query = null, $prototypeClass = null)
{
if (!$query) {
$query = $this->getBaseQuery()->limit(1);
}
$stmt = $this->getSql()->prepareStatementForSqlObject($query);
$res = $stmt->execute();
$resultSet = new ResultSet();
$arrayObjectPrototypeClass = $prototypeClass ? $prototypeClass : $this->arrayObjectPrototypeClass;
$resultSet->setArrayObjectPrototype(new $arrayObjectPrototypeClass());
$resultSet->initialize($res);
return $resultSet->current();
}
示例14: inShoppingCart
/**
* Check an item in shopping cart
*
* @param integer $objectId
* @param integer $module
* @return integer
*/
public function inShoppingCart($objectId, $module)
{
$select = $this->select();
$select->from('payment_shopping_cart')->columns(['id'])->where(['object_id' => $objectId, 'module' => $module, 'shopping_cart_id' => $this->getShoppingCartId(), 'language' => $this->getCurrentLanguage()]);
$statement = $this->prepareStatementForSqlObject($select);
$resultSet = new ResultSet();
$resultSet->initialize($statement->execute());
return $resultSet->current() ? $resultSet->current()->id : null;
}
示例15: isPageRated
/**
* Is page already rated
*
* @param integer $pageId
* @param string $slug
* @return boolean
*/
public function isPageRated($pageId, $slug = null)
{
$remote = new RemoteAddress();
$remote->setUseProxy(true);
$visitorIp = inet_pton($remote->getIpAddress());
$select = $this->select();
$select->from(['a' => 'page_rating'])->columns(['id'])->join(['b' => 'page_rating_track'], new Expression('a.id = b.rating_id and b.ip = ?', [$visitorIp]), ['track_id' => 'id'], 'left')->where(['page_id' => $pageId, 'slug' => $slug]);
$statement = $this->prepareStatementForSqlObject($select);
$resultSet = new ResultSet();
$resultSet->initialize($statement->execute());
$data = $resultSet->current();
if ($data && $data['track_id']) {
return true;
}
return false;
}