-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up the published method. #6893
Conversation
Looks like Travis is not happy. |
@infograf768 For good reason Travis wasn't happy, there was an issue indeed but is solved now. Travis is happy 😄 |
|
||
if (!is_array($pks)) | ||
{ | ||
$pks = array($pks); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think type casting is not needed here. It will causes incorrect behavior in case we call publish method of a JTable object (without passing $pks variable, just want to publish the current loaded record).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be typecasting to an array because the code expects an array as is mentioned in the docblock.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be null (If not set the instance property value is used). Please see this sample code:
require_once JPATH_ADMINISTRATOR.'/components/com_contact/tables/contact.php';
$row = JTable::getInstance('Contact', 'ContactTable');
$row->load(1);
$row->publish();
In this case, the value of $pks value is null, and the current record should be published (It doesn't work now because of a typo in the class and I made a separate PR to fix it).
@test success i published and unpublished an article successfully This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6893. |
@test - Success. Patch tested with article set both to registred and public display. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6893. |
RTC. Thanks! This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6893. |
Merged - Thanks! |
Hmm. This PR is still having issue which I pointed above. I don't think it is not good to be merged yet :(. |
@joomdonation Correct, I will create a new PR for that. |
Goal
The goal of this pull request is to clean up some code that I found is duplicate and could be improved after checking #3189. This completely removes the publish() override for the JTableContent class as it is obsolete with the update.
How to test
administrator/index.php?option=com_content&view=articles