Skip to content
This repository has been archived by the owner on Aug 10, 2022. It is now read-only.

Commit

Permalink
Fix: added method to clear mapping cache
Browse files Browse the repository at this point in the history
  • Loading branch information
szytko committed Jun 23, 2016
1 parent 5d7865e commit c9893bd
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ protected static function ensureMappingCache($value)
/**
* @param $value
*/
protected static function clearMappingCache($value)
protected static function clearEntityMappingCache($value)
{
$cacheKey = sprintf('%s:%s', get_called_class(), $value);
if (isset(static::$lazyLoadingCache[$cacheKey])) {
Expand Down Expand Up @@ -371,7 +371,7 @@ public function save()

// clears cache for saved document
if ($success) {
$this->clearMappingCache($this->_id);
$this->clearEntityMappingCache($this->_id);
}

$this->__operation = false;
Expand Down Expand Up @@ -539,6 +539,15 @@ protected function getMetadataCacheKey()
return '_metadata_' . md5(static::class);
}


/**
* Clears mapping cache
*/
public static function clearMappingCache()
{
static::$lazyLoadingCache = [];
}

/**
* @return array
*/
Expand Down

0 comments on commit c9893bd

Please sign in to comment.