Cache fields affect variable sql

More
8 years 3 months ago #65462 by jrodgar
hi!

I have found this issue:

I have a select field with the query:

SELECT id as value, name as text FROM #__contact_details WHERE user_id="{item->created_by}"

As you can see, the available values will be based on the current item. But this doesn´t fare well with this cache: github.com/FLEXIcontent/flexicontent-cck...ent.fields.php#L1742

The result is that in category list the first item is properly calculated, but for the rest , no, so when trying to get @element[ $v ], @element is not correctly populated

Caches are always tricky to implement, so on my side I´ll simple comment that line until your intervention.

Maybe you´ll need to detect if is cacheable or simply give the option from the field to turn off or on the cache for that field

Regards!

Unless otherwise indicated:
Joomla 3.8.1
Flexicontent 3.2.1.7

Please Log in or Create an account to join the conversation.

More
8 years 3 months ago #65464 by ggppdk
Hello

Actually checks for this case are implemented,
- and it is supposed to work,
You see we are calculating a "canCache" FLAG, based on if {$item->} is used in the query

But the calculation is not returned / not used, because of a bug that i see now
- the reference "&" that should be before the $canCache parameter of method doQueryReplacements()
is missing

Try adding it

In same file find and replace:
Code:
static function doQueryReplacements(&$query, &$field, &$item, &$item_pros=true, $canCache=null)

With:
Code:
static function doQueryReplacements(&$query, &$field, &$item, &$item_pros=true, & $canCache=null)


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.306 seconds
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save