While #22851 fixed bulk state changes (joomla 3.9.1), it breaks state changes when "status" column name is not published
(in Joomla core, we currently have 3 different naming for this same task: published
, state
, enabled
).
This has affected some core parts of Joomla as well as third-party extensions using a "state" column (or other naming as for Plugins manager #22953) instead of "published".
Proposed fixes #23194, #23193, #23192, #23191 add column aliases to set a bit of consistency.
Decide of a reserved name for item state and set it as required by Joomla api.
Do the needed changes in core for Joomla 4.
In PR #23197 it is proposed to revert the PR #22851 that fixed bulk state changes, in the Joomla 3 serie and postpone to Joomla 4.
Labels |
Added:
?
|
Labels |
Added:
?
|
Well... i close here, as @mbabker describes better the pros of not reserved names and the good usage of column aliases:
We really should not require explicit column names. That is exactly what this aliasing logic is supposed to take care of. In the context of com_contact, "state" refers to what most people consider a "province" and not an alias of "published" so you can't place a hard reservation on the "state" column name without creating problems for any extension with a table storing addressing data.
It can be documented that published is the preferred way and the default name core expects, but everything in core interacting with that column should be using the table API's aliasing feature and if a table uses a different column name for that feature then it should still work.
We don't force id to be a table's PK, the API lets you specify the PK for your table (and does support composite PKs so it's not even restricted to a single column). We might default to id but I don't even think that happens. The same convention applies here for published or checked_out or any other feature.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-11-29 15:19:40 |
Closed_By | ⇒ | JoomliC |
And as I said elsewhere, #22851 was done absolutely correctly and is not a B/C break as it relates to the API. What WAS wrong and exposed by that PR is:
With the introduction of column aliasing in 3.4, none of the core components actually defined these aliases unless needed for something that was already in use; all of the PRs you opened fixing that are legitimate bug fixes and should be tested/merged
The only documentation reference I could find to the feature was https://docs.joomla.org/Column_alias - from what I can tell that page is not referenced anywhere else in the docs wiki nor is there any form of documentation (be it our own as a project or third party) that actually describes the feature in context with component development. This is a failure of the project to document a core feature in a way that extension developers (or even core contributors) should know they should be aware of and use it.
Thanks for link to https://docs.joomla.org/Column_alias !
The entire point of introducing column aliasing into the Table API in 3.4 was to not force "reserved" column names. There should be something that is set as best practice, but a specific name should not be forced and if you cannot or choose not to use that name for a column/feature you should be using the aliasing capability.