Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-15987

Make table parameters an array

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 3.2.6-RC1
    • 3.3.0-b1
    • None
    • None

    Description

      Currently table parameters are all listed in tables.yml

      parameters:
          tables.acl_groups: '%core.table_prefix%acl_groups'
          tables.acl_options: '%core.table_prefix%acl_options'
          tables.acl_roles: '%core.table_prefix%acl_roles'
      # etc..

      This way, tables can only be injected one at a time.

      When making it an array they can all be injected at once, making the table parameter injection for core and extensions a whole lot easier. This way we have to rely less on constants and more on services / parameters.

      parameters:
          tables:
              acl_groups: '%core.table_prefix%acl_groups'
              acl_options: '%core.table_prefix%acl_options'
              acl_roles: '%core.table_prefix%acl_roles'

      This will allow tables to be injected individually or all at once:

      some.service:
          arguments:
              - '%tables.acl_groups%'
              - '%tables%'
      

      public function __construct($acl_groups_table, $tables)
      {
      	$this->acl_groups_table = $acl_groups_table;
      	$this->tables = $tables;
      }
       
      public function main()
      {
      	$sql = 'SELECT * FROM ' . $this->acl_groups_table;
      	
      	// or
      	
      	$sql = 'SELECT * FROM ' . $this->tables['acl_groups'];
      }

      Attachments

        Activity

          People

            Marc Marc
            mrgoldy mrgoldy [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: