在Doctrine中,我可以使用函数fetchArray()而不是execute或toArray()。我无法为Propel创建相应的这些功能。这可能吗?Propel - fetchArray或toArray
0
A
回答
2
如果你真的需要数组,你可以随时使用老同行API
$criteria = new Criteria();
/* ...setup your criteria... */
$pdoStatement = AuthorPeer::doSelectStmt($criteria);
$array = $pdoStatement->fetchAll(PDO::FETCH_ASSOC);
0
可以遍历一个推进的结果集一样,你可以用数组
$authors = AuthorQuery::create()
->limit(5)
->find();
foreach ($authors as $author) {
echo $authors->getFirstName();
}
http://www.propelorm.org/documentation/03-basic-crud.html#collections_and_ondemand_hydration
1
你可以在->find()
之后拨打toArray()
。
要么一次:
$authors = AuthorQuery::create()
->limit(5)
->find()
->toArray();
foreach ($authors as $author) {
print_r($author);
}
或循环:
$authors = AuthorQuery::create()
->limit(5)
->find()l
foreach ($authors as $author) {
print_r($author->toArray());
}
相关问题
- 1. fetchArray()省略第一个结果
- 2. Symfony - Propel - 确定当前版本的propel
- 3. Kotlin和parallelStream toArray
- 4. 泛型,ToArray等
- 5. Mongodb toArray()性能
- 6. 使用Propel
- 7. PyMongo和toArray()方法
- 8. LINQ .ToArray添加行
- 9. RxSwift toArray()不订阅
- 10. HashSet`.ToArray()`使用F#
- 11. ArgumentException当调用.ToArray()
- 12. T [] toArray(T [] a)implementation
- 13. toArray的占位符
- 14. PHP Doctrine toArray问题
- 15. 使用toArray时ArrayStoreException
- 16. 使用.Toarray方法
- 17. Cakephp 3.0 $ query-> toArray();
- 18. Propel自动表格
- 19. 包括Propel without Composer
- 20. Propel“只读”模式
- 21. 验证Symfony2和Propel
- 22. Propel和build.properties文件
- 23. 类必须声明为抽象或实现抽象方法toArray
- 24. 使用forEach和/或toArray遍历不同表的迭代命令
- 25. angular.filter groupBy和toArray和模糊
- 26. ToArray的()函数限定
- 27. 使用toArray()方法的ClassCastException
- 28. jQuery Sortable .toArray with ASP.NET MVC ActionResult
- 29. LINQ ToArray的()与条件
- 30. 从Propel迁移到Propel2