Welcome Guest, Not a member yet? Register   Sign In
DataMapper - Counting related items
#2

[eluser]WanWizard[/eluser]
Have you checked the manual? It has a section on counting related items:
Code:
$continent = new Continent;
$continent->get_by_id(1);
$count = $continent->country->person->count();

As always, if the result is not what you expect it to be, dump the query using check_last_query(). You should be able to deduct from the generated SQL what is wrong with your statement.


Messages In This Thread
DataMapper - Counting related items - by El Forum - 03-21-2011, 11:58 AM
DataMapper - Counting related items - by El Forum - 03-21-2011, 05:03 PM
DataMapper - Counting related items - by El Forum - 03-21-2011, 06:06 PM
DataMapper - Counting related items - by El Forum - 03-21-2011, 06:18 PM
DataMapper - Counting related items - by El Forum - 03-22-2011, 01:37 AM
DataMapper - Counting related items - by El Forum - 03-22-2011, 03:53 AM
DataMapper - Counting related items - by El Forum - 03-22-2011, 05:45 AM
DataMapper - Counting related items - by El Forum - 03-24-2011, 07:50 AM
DataMapper - Counting related items - by El Forum - 11-22-2012, 12:22 PM
DataMapper - Counting related items - by El Forum - 11-22-2012, 02:03 PM
DataMapper - Counting related items - by El Forum - 11-23-2012, 01:27 AM
DataMapper - Counting related items - by El Forum - 11-23-2012, 03:39 AM
DataMapper - Counting related items - by El Forum - 11-23-2012, 07:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB