I try to use count in the same way as example on the page
http://www.notorm.com/ - just on the bottom:
foreach ($db->application() as $application) {
// get count of each application's tags
echo $application->application_tag()->count("*") . "\n";
I have tried this code exactly according to the example:
foreach($DB->run() as $run)
echo $run->semester()->count('*');
and I have got a fatal error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'run_id' in 'field list'' in W:\tanecniastra\libs\notorm\NotORM\Result.php:161 Stack trace: #0 W:\tanecniastra\libs\notorm\NotORM\Result.php(161): PDOStatement->execute(Array) #1 W:\tanecniastra\libs\notorm\NotORM\MultiResult.php(93): NotORM_Result->query('SELECT COUNT(*)...', Array) #2 W:\tanecniastra\libs\notorm\NotORM\Result.php(595): NotORM_MultiResult->aggregation('COUNT(*)') #3 W:\tanecniastra\libs\notorm\NotORM\MultiResult.php(105): NotORM_Result->count('*') #4 W:\tanecniastra\templates\semesterMenu.php(13): NotORM_MultiResult->count('*') #5 W:\tanecniastra\templates\@layout.php(70) : eval()'d code(4): get_semesterMenu(Object(NotORM)) #6 W:\tanecniastra\templates\@layout.php(70): eval() #7 W:\tanecniastra\libs\global\boot.php(60): include('W:\\tanecniastra...') #8 W:\tanecniastra\index.php(50): include('W:\\tanecniastra...') #9 W:\_localhost\modul.php(57): include('W:\\tanecniastra...') #10 W:\index.p inW:\tanecniastra\libs\notorm\NotORM\Result.php on line 161
But this code works:
foreach($DB->run() as $run)
echo $run->semester->count('*');
The difference is in $run->semester->count('*') x $run->semester()->count('*')
Where is the problem ? Is the example code on
http://www.notorm.com wrong or do I have something in a bad way ?
Thanks for any comment.