1
select 쿼리의 결과 (데이터베이스 행만)를 var_dump하려고합니다. zf2 선택 결과를 var_dump하는 방법
나는 (의 facotry의 service_manager) 간단한 TableGateway이public function shwoContactFormMessages)
{
$select = new Select();
$select->from(self::$tableName);
return $this->selectWith($select);
}
MY 컨트롤러 :
object(Zend\Db\ResultSet\ResultSet)#327 (8) {
["allowedReturnTypes":protected]=>
array(2) {
[0]=>
string(11) "arrayobject"
[1]=>
string(5) "array"
}
["arrayObjectPrototype":protected]=>
object(ArrayObject)#302 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
["returnType":protected]=>
string(11) "arrayobject"
["buffer":protected]=>
NULL
["count":protected]=>
int(5)
["dataSource":protected]=>
object(Zend\Db\Adapter\Driver\Pdo\Result)#326 (8) {
["statementMode":protected]=>
string(7) "forward"
["resource":protected]=>
object(PDOStatement)#307 (1) {
["queryString"]=>
string(49) "SELECT `hw_contact_form`.* FROM `hw_contact_form`"
}
["options":protected]=>
NULL
["currentComplete":protected]=>
bool(false)
["currentData":protected]=>
NULL
["position":protected]=>
int(-1)
["generatedValue":protected]=>
string(1) "0"
["rowCount":protected]=>
int(5)
}
["fieldCount":protected]=>
int(8)
["position":protected]=>
int(0)
}
내가 위해서 var_dump 싶습니다 : 위해서 var_dump ($ 테스트)의
public function fooAction()
{
$test = $this->contactFormTable->shwoContactFormMessages();
var_dump($test);
// This will show the results the column and it is working
while ($item = $test->current())
{
echo $item->messageFrom . "<br>";
}
return $view;
}
결과 데이터베이스 행은 위의 객체 대신에 사용됩니다.
많은 감사를 나는 결과를 확인하고 열 이름과 함께 작동하도록 사용 : 당신이 필요로하는 경우
당신은 항목의 배열로 전체 결과 집합을 얻을 수 있습니다. – Haver