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

Make table parameters an array

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2.6-RC1
    • Fix Version/s: 3.3.0-b1
    • Component/s: None
    • Labels:
      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

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

              Dates

              Created:
              Updated:
              Resolved: