Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8014445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:56:14+00:00 2026-06-04T19:56:14+00:00

In app/config/config.yml I’ve added some custom settings for my bundle acme: acme_services: service_a: options:

  • 0

In app/config/config.yml I’ve added some custom settings for my bundle

acme:
    acme_services:    
      service_a:
        options: { name: I, id: X, type: F, error: E }
      service_b:
        options: { name: J, id: Z, type: F, error: E }

Now in src/ACME/Bundle/ACMEBundle/DependencyInjection/Configuration.php how do I set the default and / or check for service_a/service_b?

public function getConfigTreeBuilder()
{
    $treeBuilder = new TreeBuilder();
    $rootNode = $treeBuilder->root('acme');

    $rootNode
        ->children()
            // also removed the ->end() for each arrayNode but then I get a Fatal Error 
            ->arrayNode('acme_services')->end()
            ->arrayNode('another')->end()
            ->arrayNode('more')->end()
            ->arrayNode('blah')->end()
        ->end();

    return $treeBuilder;
}

So I need pull the service_a and service_b arrays but I’m getting Unrecognized options error for service_a and service_b.

The desired result is I would like to have both service_a and service_b in the acme_services array, this why I can validate against the acme_services array for whatever service is used, either service_a or service_b.

Note: In PHP I would write it like this: (not sure if this is correct but it’s an example)

$acme_services = array(
    'acme_services' =>
        'service_a' => array(
            'options' => array(
                'name' => 'I',
                'id'   => 'X',
                'type' => 'F',
                'error'=> 'E',
            )
        ),
        'service_b' => array(
            'options' => array(
                'name' => 'J',
                'id'   => 'Z',
                'type' => 'F',
                'error'=> 'E',
            )
        )
);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:56:17+00:00Added an answer on June 4, 2026 at 7:56 pm

    You can try :

    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('acme');
    
        $rootNode
            ->children()
                // also removed the ->end() for each arrayNode but then I get a Fatal Error 
                ->arrayNode('acme_services')
                     ->children()
                          ->arrayNode('service_a')
                              ->children()
                                  ->arrayNode('options')->end()
                          ->arrayNode('service_b')
                              ->children()
                                  ->arrayNode('options')->end()
               ->end();
    
        return $treeBuilder;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Symfony2 project with a MySQL db: #app/config/config.yml doctrine: dbal: driver: %database_driver%
How can I access web folder from config.yml in a symfony2 app ? I
this is my common app.config <?xml version=1.0 encoding=utf-8 ?> <configuration> <connectionStrings> <add name=BO connectionString=Data
Below is my app.config <?xml version=1.0 encoding=utf-8 ?> <configuration> <system.serviceModel> <services> <service name=Indexer> <endpoint
I have main config file /app/config.yml . Now i have services.yml in myBundle/resources/config/services.yml Do
Here is my setup, a bit changed standard edition. # app/config/routing.yml _internal: resource: @AcmeDemoBundle/Controller/
I have the following in my app/frontend/config/routing.yml : homepage: url: / param: { module:
I configured FR3DLdapBundle. I have to modify app/config/config.yml # app/config/config.yml fr3d_ldap: client: host: 192.168.1.101
I have got a symfony security.yml file # app/config/security.yml security: firewalls: secured_area: pattern: ^/
I have two config-files /app/config/database.yml and /app/config/userconfig.yml i don't want to put the database

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.