/** * finds if a join table record for many to many relationship exists * * @param DaoQuery $qry The dao query * @param string $rightEntity The other entity * @param int $leftId The id of the left side entity * @param int $rightId The id of the right side entity * * @return bool */ public static function existsManyToManyJoin(DaoQuery $qry, $rightClass, $leftId, $rightId) { $leftClass = $qry->getFocusClass(); $qry->where(strtolower(substr($leftClass, 0, 1)) . substr($leftClass, 1) . 'Id = ? and ' . strtolower(substr($rightClass, 0, 1)) . substr($rightClass, 1) . 'Id = ?'); $results = self::_getResults($qry, $qry->generateSelectForMTM($rightClass), array($leftId, $rightId), self::AS_ARRAY); return count($results) > 0; }