6
6
7
7
use Attribute ;
8
8
use Doctrine \Bundle \MongoDBBundle \ArgumentResolver \DocumentValueResolver ;
9
+ use RuntimeException ;
9
10
use Symfony \Bridge \Doctrine \Attribute \MapEntity ;
10
11
12
+ use function is_string ;
13
+ use function property_exists ;
14
+
11
15
#[Attribute(Attribute::TARGET_PARAMETER )]
12
16
class MapDocument extends MapEntity
13
17
{
@@ -21,7 +25,20 @@ public function __construct(
21
25
public array |string |null $ id = null ,
22
26
bool $ disabled = false ,
23
27
string $ resolver = DocumentValueResolver::class,
28
+ public ?string $ message = null ,
24
29
) {
25
- parent ::__construct ($ class , $ objectManager , $ expr , $ mapping , $ exclude , $ stripNull , $ id , null , $ disabled , $ resolver );
30
+ if (! is_string ($ this ->message )) {
31
+ parent ::__construct ($ class , $ objectManager , $ expr , $ mapping , $ exclude , $ stripNull , $ id , null , $ disabled , $ resolver );
32
+
33
+ return ;
34
+ }
35
+
36
+ if (! property_exists (MapEntity::class, 'message ' )) {
37
+ throw new RuntimeException (
38
+ 'The "message" options is not supported at "MapDocument". Please upgrade "symfony/doctrine-bridge" to "^7.1". ' ,
39
+ );
40
+ }
41
+
42
+ parent ::__construct ($ class , $ objectManager , $ expr , $ mapping , $ exclude , $ stripNull , $ id , null , $ disabled , $ resolver , $ message );
26
43
}
27
44
}
0 commit comments