File tree Expand file tree Collapse file tree
libraries/classes/Triggers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55namespace PhpMyAdmin \Triggers ;
66
7+ use PhpMyAdmin \Dbal \TableName ;
78use Webmozart \Assert \Assert ;
89use Webmozart \Assert \InvalidArgumentException ;
910
@@ -13,7 +14,7 @@ public function __construct(
1314 public readonly string $ name ,
1415 public readonly Timing $ timing ,
1516 public readonly Event $ event ,
16- public readonly string $ table ,
17+ public readonly TableName $ table ,
1718 public readonly string $ statement ,
1819 public readonly string $ definer ,
1920 ) {
@@ -37,6 +38,8 @@ public static function tryFromArray(array $trigger): self|null
3738 $ event = Event::tryFrom ($ event );
3839 Assert::notNull ($ event );
3940 Assert::string ($ table );
41+ $ table = TableName::tryFromValue ($ table );
42+ Assert::notNull ($ table );
4043 Assert::string ($ statement );
4144 Assert::string ($ definer );
4245
Original file line number Diff line number Diff line change @@ -522,7 +522,7 @@ public static function getDetails(
522522
523523 $ oneResult = [];
524524 $ oneResult ['name ' ] = $ newTrigger ->name ;
525- $ oneResult ['table ' ] = $ newTrigger ->table ;
525+ $ oneResult ['table ' ] = $ newTrigger ->table -> getName () ;
526526 $ oneResult ['action_timing ' ] = $ newTrigger ->timing ->value ;
527527 $ oneResult ['event_manipulation ' ] = $ newTrigger ->event ->value ;
528528 $ oneResult ['definition ' ] = $ newTrigger ->statement ;
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public function testTryFromArrayWithValidValues(array $trigger): void
2929 $ this ->assertSame ('trigger_name ' , $ actual ->name );
3030 $ this ->assertSame (Timing::Before, $ actual ->timing );
3131 $ this ->assertSame (Event::Update, $ actual ->event );
32- $ this ->assertSame ('test_table ' , $ actual ->table );
32+ $ this ->assertSame ('test_table ' , $ actual ->table -> getName () );
3333 $ this ->assertSame ('BEGIN END ' , $ actual ->statement );
3434 $ this ->assertSame ('definer@localhost ' , $ actual ->definer );
3535 }
You can’t perform that action at this time.
0 commit comments