[Studio Error][Fixed] The view.php file should use the game class to access the database

Game development with Board Game Arena Studio
Post Reply
Teshynil
Posts: 4
Joined: 30 December 2024, 05:37

[Studio Error][Fixed] The view.php file should use the game class to access the database

Post by Teshynil »

I am getting the following error while trying to replay the game from any previous move:

Code: Select all

Sorry, an unexpected error has occurred...

The view.php file should use the game class to access the database (reference: GS1 06/04 07:46:05)

>> Get me out of here <<

#0 /var/tournoi/release/tournoi-250402-1132-gs/www/Bga/GameFramework/GameView.php(1555): Bga\GameFramework\GameView::getUniqueValueFromDB('...')
#1 /var/tournoi/release/tournoi-250402-1132-gs/www/Bga/GameFramework/GameView.php(163): Bga\GameFramework\GameView->setReplayModeOn(Array)
#2 /var/tournoi/release/tournoi-250402-1132-gs/www/view/common/ebg.view.php(19): Bga\GameFramework\GameView->generate_content(Array)
#3 /var/tournoi/release/tournoi-250402-1132-gs/www/include/webActionCore.inc.php(311): ebg_view->generate(Array)
#4 /var/tournoi/release/tournoi-250402-1132-gs/www/index.php(340): launchWebAction('...', '...', '...', false, false, NULL, true, false)
#5 {main}
EDIT:
Additional Info Board Log:

Code: Select all

http://studio.boardgamearena.com/1/regroupchickenarmy?table=701172&replayFrom=4 0
06/04 08:16:09 [notice] [T701172] [189.182.101.189] [2409381/Teshynil0] ER-100 213 d1 c0 e128 m1 I119 A11 V0 T0 /1/regroupchickenarmy?table=701172&replayFrom=4 0
06/04 08:16:49 [info] [M] [189.182.101.189] [2409381/Teshynil0] /1/regroupchickenarmy?table=701172&replayFrom=4 0
06/04 08:16:49 [info] [T701172] [189.182.101.189] [2409381/Teshynil0] 0 SET SESSION sql_mode = 'STRICT_TRANS_TABLES' 0
06/04 08:16:49 [info] [T701172] [189.182.101.189] [2409381/Teshynil0] 0 SET SESSION wait_timeout = 60 0
06/04 08:16:49 [info] [T701172] [189.182.101.189] [2409381/Teshynil0] 0 SET SESSION interactive_timeout = 60 0
06/04 08:16:49 [info] [T701172] [189.182.101.189] [2409381/Teshynil0] 0 SET SESSION max_execution_time = 20000 0
06/04 08:16:49 [info] [T701172] [189.182.101.189] [2409381/Teshynil0] 0 BEGIN 0
06/04 08:16:49 [info] [T701172] [189.182.101.189] [2409381/Teshynil0] 0 SELECT global_id, global_value FROM global WHERE 1 0
06/04 08:16:49 [info] [T701172] [189.182.101.189] [2409381/Teshynil0] 0 SELECT player_id, player_beginner FROM player 0
06/04 08:16:49 [info] [T701172] [189.182.101.189] [2409381/Teshynil0] 0 SELECT player_id, player_name, player_no, player_avatar, player_color, player_canal, (player_id='2409381') player_is_admin, player_zombie, player_eliminated, player_next_notif_no, player_enter_game, player_ai, HEX( player_beginner ) player_beginner FROM player WHERE 1 ORDER BY player_no 0
06/04 08:16:49 [info] [T701172] [189.182.101.189] [2409381/Teshynil0] setTable 0
06/04 08:16:49 [info] [T701172] [189.182.101.189] [2409381/Teshynil0] 0 SELECT global_id, global_value FROM global WHERE 1 0
06/04 08:16:49 [info] [T701172] [189.182.101.189] [2409381/Teshynil0] Complete reinitialization of board game 0
06/04 08:16:49 [info] [T701172] [189.182.101.189] [2409381/Teshynil0] 0 COMMIT 0
06/04 08:16:49 [info] [T701172] [189.182.101.189] [2409381/Teshynil0] DB commit: action validate 0
06/04 08:16:49 [info] [T701172] [189.182.101.189] [2409381/Teshynil0] Generate content of game view 0
06/04 08:16:49 [info] [T701172] [189.182.101.189] [2409381/Teshynil0] setTable 0
06/04 08:16:49 [info] [T701172] [189.182.101.189] [2409381/Teshynil0] 0 SELECT global_id, global_value FROM global WHERE 1 0
06/04 08:16:49 [info] [T701172] [189.182.101.189] [2409381/Teshynil0] 0 SELECT player_id,player_enter_game FROM player WHERE player_id='2409381' 0
06/04 08:16:49 [error] [T701172] [189.182.101.189] [2409381/Teshynil0] Unexpected exception: The view.php file should use the game class to access the database (BGA service error 1743920209)#
#0 /var/tournoi/release/tournoi-250402-1132-gs/www/Bga/GameFramework/GameView.php(1555): Bga\GameFramework\GameView::getUniqueValueFromDB('...')#
#1 /var/tournoi/release/tournoi-250402-1132-gs/www/Bga/GameFramework/GameView.php(163): Bga\GameFramework\GameView->setReplayModeOn(Array)#
#2 /var/tournoi/release/tournoi-250402-1132-gs/www/view/common/ebg.view.php(19): Bga\GameFramework\GameView->generate_content(Array)#
#3 /var/tournoi/release/tournoi-250402-1132-gs/www/include/webActionCore.inc.php(311): ebg_view->generate(Array)#
#4 /var/tournoi/release/tournoi-250402-1132-gs/www/index.php(340): launchWebAction('...', '...', '...', false, false, NULL, true, false)#
#5 {main}h
Last edited by Teshynil on 08 April 2025, 05:07, edited 1 time in total.
User avatar
thoun
Posts: 1620
Joined: 10 December 2020, 22:25

Re: [Studio Error] The view.php file should use the game class to access the database

Post by thoun »

Tanks for reporting this! It's now fixed.
User avatar
gilthe
Posts: 17
Joined: 30 October 2015, 22:05

Re: [Studio Error][Fixed] The view.php file should use the game class to access the database

Post by gilthe »

I am still getting a closely related error in Japanese Mahjong on studio and so do the players on BGA. What is behind it and how do I fix it?

Code: Select all

Unexpected error:  The action.php file should use the game class to access the database (reference: GS1 10/04 00:01:40) ly_studio.js:1:327297
    d https://studio.boardgamearena.com:8084/data/themereleases/250409-0925/js/modules/layer/ly_studio.js:1
    Dojo 26
User avatar
thoun
Posts: 1620
Joined: 10 December 2020, 22:25

Re: [Studio Error][Fixed] The view.php file should use the game class to access the database

Post by thoun »

I hoped the message was explicit :)
if your action file is doing a DB call, like

Code: Select all

$this->getCollectionFromDb
, instead create a method in the game file doing the query and returning the result, and in the action file use

Code: Select all

$this->game->myNewFunction()
.
But maybe the action.php file has no reason to do this call, and as it calls a game function in the end, maybe it can just be moved in there?
User avatar
gilthe
Posts: 17
Joined: 30 October 2015, 22:05

Re: [Studio Error][Fixed] The view.php file should use the game class to access the database

Post by gilthe »

Well, it is explicit!
My problem is that this has worked for many years, and it is a game-breaking change deployed to a live system. I haven't looked at the code in a long time. Aka, some prior notification would have been nice.
User avatar
thoun
Posts: 1620
Joined: 10 December 2020, 22:25

Re: [Studio Error][Fixed] The view.php file should use the game class to access the database

Post by thoun »

I manually fixed all games that were using it and are in production (except a few unplayed/unmaintained alpha games). I may have missed some, but for games not yet in alpha it is indeed a change I only communicated about on the Dev Discord, my bad!
Post Reply

Return to “Developers”