Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-15987

Make table parameters an array

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.3.0-b1
    • 3.2.6-RC1
    • None
    • None

      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'];
      }

            Marc Marc
            mrgoldy mrgoldy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: