? Success

User tests: Successful: Unsuccessful:

avatar wilsonge
wilsonge
27 Mar 2014

To be partnered with akeeba/fof#315

http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33529&start=0

Instructions for Testing

  1. You will need to edit the appropriate files in FOF as here: akeeba/fof#315 to libraries/fof/table/behavior/ folder (note this can't be done with patchtester because it will go to the wrong path)

  2. Install https://github.com/wilsonge/restaurant-fof/ Create a restaurant in the backend and save it. Now make a change to the restaurant and save it again and click on the versions button. You'll see several PHP errors.

  3. Now apply #3375

  4. Click on the versions button again and all the versions should appear happily and work as expected

avatar wilsonge wilsonge - open - 27 Mar 2014
avatar nikosdion
nikosdion - comment - 27 Mar 2014

George, instead of the yucky code you can modify /libraries/cms.php and have it include_once FOF's include.php right after it loads JLoader. You could actually do something like in cms.php:

if (!class_exists('FOFAutoloaderFof'))
{
include_once JPATH_PLATFORM . '/fof/include.php';
}

Moreover, I would change your if-block in contenttype.php to a more elegant two-liner:
$class = isset($tableInfo->special->class)) ? $tableInfo->special->class : 'JTable';
$result = $class::getInstance($tableInfo->special->type, $tableInfo->special->prefix);

It's more generic and doesn't look atrocious. Double win!

PS: If you want to be thorough maybe you can check if $class implements JTableInterface, i.e.
if (!class_implements($class, 'JTableInterface'))
{
// Maybe throw an exception, write something to the log...
}

avatar wilsonge
wilsonge - comment - 27 Mar 2014

OK Done that.

I did a RuntimeException for the JTableInterface - but our getInstance() method isn't actually in the Interface - so I'm not sure how much it matters - because if you input the wrong params into that method you're still screwed.

I really want to avoid if possible autoloading FOF on every single page. I'd rather load it when we need it if possible :/ So just done a more explicit check for FOF

4515125 27 Mar 2014 avatar wilsonge Typo
avatar nikosdion
nikosdion - comment - 27 Mar 2014

The way I told you to implement it you are not autoloading FOF. You are only loading the autoloader. Unless you try accessing a FOF* class nothing is loaded. That's what an autoloader is all about. God forbid if we had to load into PHP memory all framework classes every time we wanted to use FOF!

f47ebd2 27 Mar 2014 avatar wilsonge Oops
avatar wilsonge
wilsonge - comment - 27 Mar 2014

Ahh consider it done then :) How would you feel about adding the getInstance method into JTableInterface?

avatar wilsonge wilsonge - reference | - 27 Mar 14
avatar wilsonge wilsonge - change - 27 Mar 2014
Title
Yucky code to let FOF work with contenthistory
Let FOF work with contenthistory
avatar wilsonge wilsonge - change - 27 Mar 2014
Title
Let FOF work with contenthistory
Let FOF work with Content History
avatar wilsonge wilsonge - change - 27 Mar 2014
Title
Let FOF work with Content History
[#33529] Let FOF work with Content History
avatar mbabker mbabker - reference | - 3 Aug 14
avatar mbabker mbabker - change - 3 Aug 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-08-03 16:13:49
avatar mbabker mbabker - close - 3 Aug 2014
avatar mbabker mbabker - close - 3 Aug 2014
avatar wilsonge wilsonge - head_ref_deleted - 3 Aug 2014
avatar Sophist-UK Sophist-UK - reference | 786c85d - 7 Oct 14

Add a Comment

Login with GitHub to post a comment