2011-12-29 2 views
0

Doctrine에서 나는 execute 또는 toArray() 대신 fetchArray() 함수를 사용할 수 있습니다. 나는 Propel에 대해 이러한 기능을 찾을 수 없다. 이것이 가능한가? 당신이 정말로 배열을 필요로하는 경우Propel - fetchArray 또는 toArray

답변

2

당신이 할 수처럼 설정 추진 결과를 반복 할 수

$criteria = new Criteria(); 
/* ...setup your criteria... */ 
$pdoStatement = AuthorPeer::doSelectStmt($criteria); 
$array = $pdoStatement->fetchAll(PDO::FETCH_ASSOC); 
1

당신에게 ->find() 바로 뒤에 toArray()으로 전화 할 수 있습니다. 한 번에

다음 중 하나를

$authors = AuthorQuery::create() 
    ->limit(5) 
    ->find()l 
foreach ($authors as $author) { 
    print_r($author->toArray()); 
} 
:
$authors = AuthorQuery::create() 
    ->limit(5) 
    ->find() 
    ->toArray(); 
foreach ($authors as $author) { 
    print_r($author); 
} 

또는 루프에서