getBeans() always returns the cached value even if asked not to

I have a logic_hook, well a series of logic hooks really, that creates two RLIs, then updates those RLIs and then in another hook it tests those RLI to see if they are completed.

The update is to set them to completed.  I looked in the DB and they are set to completed.

That last step (in another logic file) has this code

            $rliBeans = $oppBean->revenuelineitems->getBeans(array('use_cache' => false),array('use_cache' => false));

Which returns the two RLIs but BOTH of them are shown as NOT being completed.  I looked at the getBeans() function and there is no mention of the 'use_cache' param.  If its in the cache it just returns it.

Also I dont know why the update to completed is not reflected in the cache but I see that a lot.  I use the 'use_cache' param just about everywhere in system-wide code (stuff that users dont generally run in the UI). 

My current work around is to do this

            $rliBeans = $oppBean->revenuelineitems->getBeans(array('use_cache' => false));

So I empty the cache before I getBeans().

Does anyone have some wisdom for me?

  • There is no evidence that class Link2 evaluates parameter 'use_cache' anyhow.

    Also, after browsing Link2 class I realized that you may need to fix one of your lines:




    $oppBean->revenuelineitems->beans=null; // or empty or anything but array();

    Method getBeans evaluates if beans has bean loaded before by checking if it is an array, that is it, it doesn't not evaluate if the array is not empty because a relationship may return an empty list.

    Good luck!

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • I'll look into that replacement but as far as I know I am trying to get past line 465

    if (empty($this->beans[$id]))

    so if $this->beans is an empty array I am OK.  Are you seeing something else?   I am working in 10.0.4 at the moment.

  • I can not see anything wrong neither in your code or related methods at Link2 and BeanFactory. That is weird!

    André Lopes
    Lampada Global
    Skype: andre.lampada
Reply Children
No Data