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

            $oppBean->load_relationship('revenuelineitems');
            $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

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

So I empty the cache before I getBeans().

Does anyone have some wisdom for me?

Parents
  • 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:

    Replace

    $oppBean->revenuelineitems->beans=array();

    by

    $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
Reply
  • 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:

    Replace

    $oppBean->revenuelineitems->beans=array();

    by

    $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
Children