Skip to content

[FEATURE] Configure inventories via guides.xml #586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 9, 2023
Merged

Conversation

linawolf
Copy link
Contributor

@linawolf linawolf commented Sep 9, 2023

No description provided.

@jaapio jaapio merged commit 481cc03 into main Sep 9, 2023
@jaapio jaapio deleted the feature/paths branch September 9, 2023 11:38
@@ -40,4 +40,15 @@

<xsd:attribute name="extends" type="xsd:string"/>
</xsd:complexType>

<xsd:complexType name="inventories">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only defines the (complex) type named inventories but it doesn't use the type anywhere.

You need to also add <xsd:element name="inventories" type="inventories"> add the top of this document.

@@ -39,6 +39,18 @@ public function getConfigTreeBuilder(): TreeBuilder
->scalarNode('version')->end()
->end()
->end()
->arrayNode('inventories')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also make this mode a prototyped array node. And add ->fixXmlConfig('inventory', 'inventories') (see the 4th example in https://symfony.com/doc/current/components/config/definition.html#array-nodes ).

This creates a config like

<guides>
  <inventory>...</inventory>
  <inventory>...</inventory>
</guides>

And produces an array ['inventories' => ['...', '...']]

This is the common approach used by Symfony bundles when dealing with prototype nodes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants