I tried figuring this out on my and have racked my brain for about 6 hours. I am just not sure what the ORM is sending to the db.
Schema is:
usermovie:
id
last_watched timestamp
etc
movie:
id
title
runtime
etc
user:
id
username varchar
etc
movies_usermovies:
id
movie_id
usermovie_id
usermovies_users:
id
user_id
usermovie_idI am trying to determine is a user has a movie:
$tmpUser = new User();
tmpUser->where ( 'username', $username);
$tmpUser->get();
$usermovies = $tmpUser->usermovie->like_related_movie('title', $movie->title)->order_by_related_movie('title')->get();
echo "
count is ".$usermovies->count(); //return 3
echo "
count is ".count($usermovies->all); // returns 3
echo "
count is ".count($usermovies); // returns 1When in fact the user does not have a usermovie that is related to the title. Does that make enough sense to provide me with some help? Is there I way I can print out what sql is being sent to the DB? That would help be debug this as well.