Sorry!
I need help
I have in my x.js
const selectedCardIds = [8, 12, 25]; // Array of integers
this.bgaPerformAction('actPlayCard', {
cardIds: selectedCardIds // Sends as an array
});
In my game.php
public function actPlayCard(#[IntArrayParam(name: 'cardIds')] array $cardIds)
{
// Debugging the received data
error_log('Received cardIds: ' . print_r($cardIds, true));
// Continue with the game logic
}
But i have errors
I wouldn't ask for help, but I've been stuck on this topic for 4 days.
I want to send the card IDs through JS and have PHP, for example, log that it has received them.
I've tried many ways to send the information and all of them give me an error.
The error :
Server syntax error:
Fatal error: Uncaught Error: Attribute class "Bga\Games\AceOfSpadesP\IntArrayParam" not found in /var/tournoi/release/tournoi-250416-0910-gs/www/Bga/GameFramework/GameAction.php:482 Stack trace: #0 /var/tournoi/release/tournoi-250416-0910-gs/www/Bga/GameFramework/GameAction.php(482): ReflectionAttribute->newInstance() #1 /var/tournoi/release/tournoi-250416-0910-gs/www/Bga/GameFramework/GameAction.php(584): Bga\GameFramework\GameAction->bgaGetParameterValue(Object(ReflectionParameter), '...') #2 [internal function]: Bga\GameFramework\GameAction->Bga\GameFramework{closure}(Object(ReflectionParameter)) #3 /var/tournoi/release/tournoi-250416-0910-gs/www/Bga/GameFramework/GameAction.php(584): array_map(Object(Closure), Array) #4 /var/tournoi/release/tournoi-250416-0910-gs/www/include/webActionCore.inc.php(208): Bga\GameFramework\GameAction->performServerAction('...') #5 /var/tournoi/release/tournoi-250416-0910-gs/www/index.php(262): launchWebAction('...', '...', '...', false, false, NULL, true, false) #6 {main} thrown in /var/tournoi/release/tournoi-250416-0910-gs/www/Bga/GameFramework/GameAction.php on line 482
I've tried everything, there's just no way.
If you have a working example, that would be great.
I need help
I have in my x.js
const selectedCardIds = [8, 12, 25]; // Array of integers
this.bgaPerformAction('actPlayCard', {
cardIds: selectedCardIds // Sends as an array
});
In my game.php
public function actPlayCard(#[IntArrayParam(name: 'cardIds')] array $cardIds)
{
// Debugging the received data
error_log('Received cardIds: ' . print_r($cardIds, true));
// Continue with the game logic
}
But i have errors
I wouldn't ask for help, but I've been stuck on this topic for 4 days.
I want to send the card IDs through JS and have PHP, for example, log that it has received them.
I've tried many ways to send the information and all of them give me an error.
The error :
Server syntax error:
Fatal error: Uncaught Error: Attribute class "Bga\Games\AceOfSpadesP\IntArrayParam" not found in /var/tournoi/release/tournoi-250416-0910-gs/www/Bga/GameFramework/GameAction.php:482 Stack trace: #0 /var/tournoi/release/tournoi-250416-0910-gs/www/Bga/GameFramework/GameAction.php(482): ReflectionAttribute->newInstance() #1 /var/tournoi/release/tournoi-250416-0910-gs/www/Bga/GameFramework/GameAction.php(584): Bga\GameFramework\GameAction->bgaGetParameterValue(Object(ReflectionParameter), '...') #2 [internal function]: Bga\GameFramework\GameAction->Bga\GameFramework{closure}(Object(ReflectionParameter)) #3 /var/tournoi/release/tournoi-250416-0910-gs/www/Bga/GameFramework/GameAction.php(584): array_map(Object(Closure), Array) #4 /var/tournoi/release/tournoi-250416-0910-gs/www/include/webActionCore.inc.php(208): Bga\GameFramework\GameAction->performServerAction('...') #5 /var/tournoi/release/tournoi-250416-0910-gs/www/index.php(262): launchWebAction('...', '...', '...', false, false, NULL, true, false) #6 {main} thrown in /var/tournoi/release/tournoi-250416-0910-gs/www/Bga/GameFramework/GameAction.php on line 482
I've tried everything, there's just no way.
If you have a working example, that would be great.