Vasiliy vvscode Vanchuk
Vasiliy vvscode Vanchuk

Reputation: 7159

List of all available options on configuring service in Symfony2

i start work with symfony2

Now i write configs in .yml files and use constructions like this

services:
    my_mailer:
        # ...

    email_formatter_manager:
        class:     EmailFormatterManager
        # ...

    email_configurator:
        class:     EmailConfigurator
        arguments: ["@email_formatter_manager"]
        # ...

It's ok. The question is - where i can find list of all available option for describing service?

Yep, i fond source of Symfony\Component\DependencyInjection\Definition and i understand that i can get list from setters. But i still hope to find man page with review for this params. Can anybody help with link?

Thanks

Upvotes: 2

Views: 401

Answers (2)

jack
jack

Reputation: 185

You can take a look at the xsd of the services.xml where is described every syntax of the structure (with yml differ only in how you describe not in the function). As example you see samething like this for available key for service:

  <xsd:complexType name="service">
    <xsd:choice maxOccurs="unbounded">
      <xsd:element name="file" type="xsd:string" minOccurs="0" maxOccurs="1" />
      <xsd:element name="argument" type="argument" minOccurs="0" maxOccurs="unbounded" />
      <xsd:element name="configurator" type="configurator" minOccurs="0" maxOccurs="1" />
      <xsd:element name="call" type="call" minOccurs="0" maxOccurs="unbounded" />
      <xsd:element name="tag" type="tag" minOccurs="0" maxOccurs="unbounded" />
      <xsd:element name="property" type="property" minOccurs="0" maxOccurs="unbounded" />
    </xsd:choice>
    <xsd:attribute name="id" type="xsd:string" />
    <xsd:attribute name="class" type="xsd:string" />
    <xsd:attribute name="scope" type="xsd:string" />
    <xsd:attribute name="public" type="boolean" />
    <xsd:attribute name="synthetic" type="boolean" />
    <xsd:attribute name="synchronized" type="boolean" />
    <xsd:attribute name="lazy" type="boolean" />
    <xsd:attribute name="abstract" type="boolean" />
    <xsd:attribute name="factory-class" type="xsd:string" />
    <xsd:attribute name="factory-method" type="xsd:string" />
    <xsd:attribute name="factory-service" type="xsd:string" />
    <xsd:attribute name="alias" type="xsd:string" />
    <xsd:attribute name="parent" type="xsd:string" />
  </xsd:complexType>

Available at this link

Upvotes: 1

Jason Roman
Jason Roman

Reputation: 8276

You can use Symfony commands to get a list of all available Bundles, and then drill-down to get both their default configuration (if defined) and their current configuration. For example:

Lists all of the bundles:

# can also use config:debug (or debug:config in Symfony 2.6 or later)
php app/console config:dump-reference

Lists the default configuration for a bundle:

php app/console config:dump-reference WebProfilerBundle

Outputs:

# Default configuration for "WebProfilerBundle"
web_profiler:
    toolbar:              false
    position:             bottom
    intercept_redirects:  false

Lists the current configuration for a bundle:

# Symfony <= 2.6
php app/console config:debug WebProfilerBundle

# Symfony 2.6+
php app/console debug:config WebProfilerBundle

Outputs:

# Default configuration for "WebProfilerBundle"
web_profiler:
    toolbar: false
    intercept_redirects: false
    position: bottom

In Symfony 2.6 and above, the main command switched to debug:config, but config:debug is set as an alias so that still works.

Upvotes: 1

Related Questions