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 7657753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:06:01+00:00 2026-05-31T13:06:01+00:00

Scenario: I’m using a bundle (FOSFacebookBundle) that allows me to set parameters for exactly

  • 0

Scenario:

I’m using a bundle (FOSFacebookBundle) that allows me to set parameters for exactly one facebook app in my configuration. Everything works perfectly fine, but now I need to set not only one app, but multiple.

My approach:

I’ve created a AcmeFacebookBundle, which allows multiple apps to be defined (configuration defined in Acme\FacebookBundle\DependencyInjection\Configuration) in an array like so:

acme_facebook:
    apps:
        some_competition:
            server_url: %acme.facebook.some_competition.server_url%
            file:   %kernel.root_dir%/../vendor/facebook/php-sdk/src/base_facebook.php
            alias:  facebook
            app_id: %acme.facebook.some_competition.app_id%
            secret: % acme .facebook.some_competition.secret%
            cookie: true
            permissions: [email, user_birthday, user_location]
        some_other_competition:
            server_url: %acme.facebook. some_other_competition.server_url%
            file:   %kernel.root_dir%/../vendor/facebook/php-sdk/src/base_facebook.php
            alias:  facebook
            app_id: %acme.facebook. some_other_competition.app_id%
            secret: % acme .facebook. some_other_competition.secret%
            cookie: true
            permissions: [email, user_birthday, user_location]

In Acme\FacebookBundle\DependencyInjection\AcmeFacebookExtension I am then looping through all apps. The idea is to compare the server_url parameter against the current URL and override the fos_facebook configuration with mine.

class AcmeFacebookExtension extends Extension
{
    ...
    /**
     * {@inheritDoc}
     */
    public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        foreach ($config['apps'] as $app)
        {
            // check for matching path here?
            foreach (array('file', 'app_id', 'secret', 'cookie', 'domain', 'logging', 'culture', 'permissions') as $attribute)
            {
                $container->setParameter('fos_facebook.' . $attribute, $app[$attribute]);
            }
        }
    }

Problem:

But this is exactly where I’m stuck. Obviously, I have no access to the Request object or the DiC from within AcmeFacebookExtension to do this comparison.
Am I going completely wrong in my approach? Do you have any better idea on how to tackle this problem?

  • 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-05-31T13:06:02+00:00Added an answer on May 31, 2026 at 1:06 pm

    What you want to create is a CompilerPass so that you can manipulate the Container after all other configuration has loaded. These should get you started:

    • Symfony2: Service Container Compiler Passes
    • Symfony2: Manipulating Service Parameters and Definitions
    • Create a CompilerPass
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Scenario: Ruby on Rails app that returns JSON to an iOS application using json-framework
Scenario: An MVC3 app that uses constructor injection to provide services for a given
Scenario I'm using a Custom IPrincipal and IIdentity to do asp.net authorization. I set
Scenario: I build a simple web based app for mobile that needs to interact
Scenario: You have an ASP.Net webpage that should display the next image in a
Scenario: I'm currently writing a layer to abstract 3 similar webservices into one useable
Scenario is that we send out thousands of emails through SMTP server. Content is
Scenario: An event is raised in class A that needs to be handled by
Scenario I have two wrappers around Microsoft Office, one for 2003 and one for
Scenario: Most smartphones have a high resolution camera that generates photos that may range

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.