I am developing a PHP app with Propel ORM as a model. It's installed via Composer and all classes are auto-loaded correctly. I can create querys, access database and retrieve data to populate my page. Nice.
But I'm having trouble with some methods like isLast()
. According to documentation, you can use it as follows:
$books = BookQuery::create()->find();
foreach ($books as $book){
if($books->isLast()){
// Do something
}
}
I can't even replicate this simple example. I have simplified my code in order to see if it works (with my own tables and columns names):
$provincias=ProvinciasQuery::create()->find();
foreach($provincias as $v){
echo $v->getProvinciasNombre(); // This works!
if($provincias->isLast()){ // This doesn't :(
// Do something
}
}
I get always the same error:
Fatal error: Uncaught exception 'Propel\Runtime\Exception\BadMethodCallException' with message 'Call to undefined method: isLast' in /path/to/my/app/vendor/propel/propel/src/Propel/Runtime/Collection/Collection.php on line 558
Same happens with other methods like isEven()
, isOdd()
or isFirst()
. Method isEmpty()
seems to work fine.
Any help would be appreciated.