You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ok. For experiment's sake I've modified the constructor in the BlueprintBuilder:
publicfunction__construct() {
$this->blueprint = newBlueprint();
$this->blueprint->setConstants( new \ArrayObject() );
$this->blueprint->setSiteOptions( new \ArrayObject() );
}
And it did move on. (Which, in my case, is an error wile executing step downloadWordPress.) But let's stick to the topic of this issue. What would be a suitable solution here? This, some other way to make those params ArrayObjects or rather the opis validation accepting array()?
@maypaw - e2e tests are also blocked here, could you take a look? This is also a case where a quick unblocking fix exists, but a bit more effort is needed to solve the problem comprehensively.
I have looked into this issue and it seems to me that the suggested solution in BlueprintBuilder.php addresses the outcome, but not the source of the problem. I think that the cause lies somewhere in autogenerate_models.php script and how the types from schema.json are interpreted and then assigned as the default value. Improving this seems like cleaner option.
However, to be honest, I don't really know how the jane-php/json-schema or nette/php-generator generate the models, so I'll look into that first and analyse how an ArrayObject can be assigned instead of an array.
Activity
adamziel commentedon Mar 19, 2024
Aha, that's Opis not liking
constantsdefaulting toarray()– it needs to be an\ArrayObject()instance.reimic commentedon Mar 19, 2024
Ok. For experiment's sake I've modified the constructor in the
BlueprintBuilder:And it did move on. (Which, in my case, is an error wile executing step downloadWordPress.) But let's stick to the topic of this issue. What would be a suitable solution here? This, some other way to make those params ArrayObjects or rather the opis validation accepting
array()?adamziel commentedon Mar 19, 2024
What you've done is spot on. That, and removing
array()as the default value.adamziel commentedon Mar 19, 2024
...actually, perhaps setting the default to
(object) array()would also work 🤔reimic commentedon Jun 8, 2024
@maypaw - e2e tests are also blocked here, could you take a look? This is also a case where a quick unblocking fix exists, but a bit more effort is needed to solve the problem comprehensively.
maypaw commentedon Jun 8, 2024
@reimic I'll check this out. Looks like it may be connected to the issues with the blueprint compiling scripts as well.
maypaw commentedon Jun 16, 2024
I have looked into this issue and it seems to me that the suggested solution in
BlueprintBuilder.phpaddresses the outcome, but not the source of the problem. I think that the cause lies somewhere inautogenerate_models.phpscript and how the types from schema.json are interpreted and then assigned as the default value. Improving this seems like cleaner option.However, to be honest, I don't really know how the
jane-php/json-schemaornette/php-generatorgenerate the models, so I'll look into that first and analyse how anArrayObjectcan be assigned instead of anarray.adamziel commentedon Jul 24, 2025
We no longer use code generation – it added too much complexity. The current version of the library deals with parsed JSON arrays directly.