Skip to content

Conversation

@davidjosephhayes
Copy link
Contributor

@davidjosephhayes davidjosephhayes commented Oct 18, 2016

Pull Request for Issue # .

Summary of Changes

Set JTable and JModelAdmin to use the JTable::_columnAlias property for ordering. Defaults to original behavior when there is no ordering property of JTable::_columnAlias.

Basically this implements what the function documentation for JTable::getColumnAlias says:
* Method to return the real name of a "special" column such as ordering, hits, published
* etc etc. In this way you are free to follow your db naming convention and use the
* built in Joomla functions.

Testing Instructions

Use any built in component and reorder items.

Documentation Changes Required

None.

{
// If there is no ordering field set an error and return false.
if (!property_exists($this, 'ordering'))
$orderingField = $this->getColumnAlias('ordering');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surely this is not doing what the doc block above it says?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would you change the doc block?

@davidjosephhayes
Copy link
Contributor Author

davidjosephhayes commented Oct 19, 2016

I updated the code comments where it is throwing an exception instead of setting an error and returning false.

@davidjosephhayes
Copy link
Contributor Author

Is there something else I should change?

@davidjosephhayes
Copy link
Contributor Author

bump

@andrepereiradasilva
Copy link
Contributor

needs two successfull tests to get merged in the core.

@csthomas
Copy link
Contributor

@davidjosephhayes
Copy link
Contributor Author

Both should be fixed now @csthomas

@RonakParmar
Copy link

I have tested this item ✅ successfully on fd08d7b

Tested ordering of articles before and after PR, in both case ordering working fine.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12464.

@csthomas
Copy link
Contributor

csthomas commented Nov 30, 2016

What about other files:

libraries/joomla/table/nested.php:1299:  if (property_exists($this, 'ordering'))
libraries/joomla/table/asset.php:168:    if (property_exists($this, 'ordering'))

I'm not sure but IMHO nested.php should be changed too.

@davidjosephhayes
Copy link
Contributor Author

Never used those classes. I bet you are right.

I will run through the rest of the libraries and see if there are others.

@mbabker
Copy link
Contributor

mbabker commented Nov 30, 2016

Only JTable and JTableNested need to have this abstraction layer. The other subclasses are "final" implementations for each table.

@davidjosephhayes
Copy link
Contributor Author

I added the abstraction layer to JTableNested.

I feel like it should be on JTableAsset as well @mbabker since it is using a variable for the table name.

@mbabker
Copy link
Contributor

mbabker commented Nov 30, 2016

A lot of the JTable subclasses reference the class variables in the methods versus hardcoding things like the table key(s) or name. JTableAsset is the class directly mapping to the #__assets table so it shouldn't need direct mapping like the other two classes have. Unfortunately, we neither declare the base classes (JTable or JTableNested) as abstract nor the "final" subclasses as final, so by that argument every column name supported by the abstraction layer should technically be mapped in the same way in all subclasses in case they are subclassed further by other developers. Personal opinion, I don't think it's needed for instances where it's supposed to be a final object, but I'll let someone else make the final judgement call on it.

@davidjosephhayes
Copy link
Contributor Author

Gotcha. I end up extending core classes a lot, so its always nice when the abstraction is already there. However, abstracting everything is likely out of the scope of this PR.

// If the table has an ordering field, use that for ordering.
if (property_exists($this, 'ordering'))
$orderingField = $this->getColumnAlias('ordering');
if (!property_exists($this, $orderingField))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to remove exclamation mark.

@davidjosephhayes
Copy link
Contributor Author

That was just terrible. What I get for rushing.

@csthomas
Copy link
Contributor

csthomas commented Dec 2, 2016

I tested successful
and on review I have not found any ordering column in JTableNested subclasses.
It is not used by joomla at all but because of B/C it probably has to stay.
That OK.

Code style:
I thought that before if () code line there should be a comment or empty line.
Am I wrong?

@davidjosephhayes
Copy link
Contributor Author

No idea. I don't see anything in here though however: http://joomla.github.io/coding-standards/?coding-standards/chapters/php.md

@csthomas
Copy link
Contributor

csthomas commented Dec 2, 2016

I have tested this item ✅ successfully on 32a6436

Joomla works normal.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12464.

@davidjosephhayes
Copy link
Contributor Author

How does the HumanTestResults test work?

@dgrammatiko
Copy link
Contributor

I have tested this item ✅ successfully on 32a6436


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12464.

@jeckodevelopment
Copy link
Member

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12464.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Dec 20, 2016
@jeckodevelopment jeckodevelopment added this to the Joomla 3.7.0 milestone Dec 20, 2016
@zero-24
Copy link
Contributor

zero-24 commented Dec 20, 2016

How does the HumanTestResults test work?

@davidjosephhayes you can take a look here: https://docs.joomla.org/Testing_Joomla!_patches#Recording_test_results

It is a feature of ours custom issue tracker arround GitHub :)

@zero-24
Copy link
Contributor

zero-24 commented Dec 21, 2016

With the last 4 commit i have fixed some CS Issue travis did not mention (why?) and updated this branch to the last staging.

@zero-24
Copy link
Contributor

zero-24 commented Dec 21, 2016

@rdeutz @wilsonge please take a final review and merge decision here.

@jeckodevelopment
Copy link
Member

@davidjosephhayes could you please look at the conflicts?

@davidjosephhayes
Copy link
Contributor Author

Is it just me or is the conflict page not loading?

@csthomas
Copy link
Contributor

For me it is not working too.

@jeckodevelopment
Copy link
Member

@davidjosephhayes this is the conflicting file:
libraries/joomla/table/table.php

@davidjosephhayes
Copy link
Contributor Author

How do I do know what to fix? When I click the Resolive Conflicts, nothing loads.

@wilsonge
Copy link
Contributor

I should have fixed conflicts here. Can I have one tester to confirm this PR still works please

@wilsonge wilsonge removed the RTC This Pull Request is Ready To Commit label Dec 27, 2016
@RonakParmar
Copy link

I have tested this item ✅ successfully on fc626b1


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12464.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Dec 27, 2016
@rdeutz rdeutz merged commit 4eb5371 into joomla:staging Dec 27, 2016
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Dec 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.