I've gotta return the row by player Id, if there is no row, make one. This cant be the best way to do it.
class PlayerRafPeer extends BasePlayerRafPeer {
/**
* Returns a PlayerRaf object by playerId.
* @param int $player_id
* @param PDO $con
* @return PlayerRaf
*/
public static function retrieveByPlayerId($player_id, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$criteria = new Criteria();
$criteria->add(self::PLAYER_ID, $player_id);
$v = self::doSelectOne($criteria, $con);
if (!$v) {
$player = new PlayerRaf();
$player->setPlayerId($player_id)
->setEmailCount(0)
->setDate(date("Y-m-d"), time());
self::doInsert($player, $con);
return $player;
}
return $v;
}