/**
  * @return mixed
  */
 protected function _getIndexedTables()
 {
     if (($indexed_tables = Cache::read('Related.indexedTables')) === false) {
         $InRelatedIndexBehavior = new InRelatedIndexBehavior(TableRegistry::get(''));
         $InRelatedIndexBehavior->refreshCache();
         $indexed_tables = Cache::read('Related.indexedTables');
     }
     return $indexed_tables;
 }
 public function beforeSave($event, $entity, $options)
 {
     if (isset($entity->related)) {
         //TODO, related are being marked as dirty even when they are not
         foreach ($this->_InRelatedIndexBehavior->getTablesWithBehaviorNames() as $tablesWithBehaviorName) {
             $entity->dirty('related-' . $tablesWithBehaviorName, true);
         }
     }
     return true;
 }