"그러나 나는이 같은 사용자 지정 쿼리를 만들 때 내가 배열의 결과를 얻을"
당신은 코드에서 docblock에 따라 배열을 반환
Zend_Db_Adapter_Abstract::fetchAll()
를 호출하기 때문에 배열을 얻고있다
: -
/**
* Fetches all SQL result rows as a sequential array.
* Uses the current fetchMode for the adapter.
*
* @param string|Zend_Db_Select $sql An SQL SELECT statement.
* @param mixed $bind Data to bind into SELECT placeholders.
* @param mixed $fetchMode Override current fetch mode.
* @return array
*/
public function fetchAll($sql, $bind = array(), $fetchMode = null)
"나는 내 DBTABLE에 fetchAll()를 부른하고 언제 DBTABLE에 정의 된 적절한 DbRow 클래스에 결과를 얻을 수 있습니다." 당신은 당신이 Zend_Db_Table_Abstract::fetchAll()
을 요구하고이 작업을 수행 할 때
이되는 코드의 docblock에 따라 반환하는 Zend_Db_Table_Rowset
: -
/**
* Fetches all rows.
*
* Honors the Zend_Db_Adapter fetch mode.
*
* @param string|array|Zend_Db_Table_Select $where OPTIONAL An SQL WHERE clause or Zend_Db_Table_Select object.
* @param string|array $order OPTIONAL An SQL ORDER clause.
* @param int $count OPTIONAL An SQL LIMIT count.
* @param int $offset OPTIONAL An SQL LIMIT offset.
* @return Zend_Db_Table_Rowset_Abstract The row results per the Zend_Db_Adapter fetch mode.
*/
public function fetchAll($where = null, $order = null, $count = null, $offset = null)
"이 데이터 공업의 DbRows를 수신 강제 할 수있는 모든 매개 변수가 아니면 내가 직접 행을 만들고 그 배열을 채워야합니까? "
아니요. 올바른 개체에서 올바른 메서드를 호출하면 행 집합이 반환됩니다.
이 라인이 변경하려면 다음을 수행합니다 -
$query = $this->_dbTable->getDefaultAdapter()->select()
사람 : -
$query = $this->_dbTable->select()
이 라인 : -
return $this->_dbTable->getDefaultAdapter()->fetchAll($query);
사람 : -
return $this->_dbTable->fetchAll($query);
그러면 필요한 것을 얻을 수 있습니다. ZF에 갇혀 있으면 코드를 살펴 보는 것이 좋습니다. 최고의 문서를 사용할 수 있습니다.
변경된 후에는 DbRows로 구성된 배열의 행 집합을 가져옵니다. 무결성 검사를 false로 설정해야했습니다. 그래서 마침내 젠드에서 포즈을달라고하는 것이 무엇입니까? –