firegate666 / Textadventure-NextGen

Create a next generation browser game textadventure manager where you can build and player adventures.
Apache License 2.0
1 stars 0 forks source link

fix model AdventureLog #14

Closed firegate666 closed 12 years ago

firegate666 commented 12 years ago

remove hardcoded sql

public static function getLastStep($user_id, $adventure_id)
    {
        $log = AdventureLog::model()->findBySql('
            SELECT
                *
            FROM
                "AdventureLog" 
            WHERE
                "userId" = :userId AND
                "adventureId" = :adventureId AND
                "finalized" = 0
            ORDER BY
                "createdAt" DESC
            LIMIT
                1
        ', array(
            ':userId' => $user_id,
            ':adventureId' => $adventure_id,
        ));

        if ($log === null)
        {
            return null;
        }
        return $log->adventureStepId;
    }
firegate666 commented 12 years ago

fixed with e4c898e31cf5121b73e1a47da14c2f7cd933af28