Currently the built-in database backend has db table name repeated many times in its code (Drupal\advancedqueue\Plugin\AdvancedQueue\BackendDatabase). This to be avoided and to use a member property to keep the db table name and use that property replacing hardcoded table name across the code.
I faced this as an issue when extending the built-in database backend to use a different table to store jobs. Having the table name hardcoded, it forces me to duplicate most of the member methods just to replace the table name. Having table name on member property variable, the new extending backend class can have much less code as most of logic are same.
(As a background info: I want to use a new table just to make "job_id" column in the table "varchar" instead of "serial". So, we can set non numeric custom strings as job IDs. Having custom strings as job ids will help to identify whether a certain job is already queued/processed before creating it. We can construct Job ID of certain patterns values depending on the job)
Issue fork advancedqueue-3462741
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
junaidpvPlease review the MR just updated.
Comment #4
johnwebdev commentedI think this is a reasonable change.
Comment #5
jsacksick commentedPerhaps we should make this a public const (or a protected const) that can be overridden by a child backend plugin if needed.
Comment #6
sayan_k_dutta commentedWorking on it.
Comment #7
sayan_k_dutta commentedMade the changes. Please review.
Comment #8
koustav_mondal commentedChanges looks good to me. Protected const is also declared. Moving to RTBC.
Comment #9
alexpottComment #11
alexpottThis looks great - I checked for any other direct usages of the table in the module and there were none.
Comment #13
alexpott@jsacksick pointed out that self:: was not right when paired with a protected const. Fixed this post commit. Great catch @jsacksick!