public function setToCache(IEntity $entity) { $id = $entity->getIdentifier(); $class_name = get_class($entity); if (!array_key_exists($class_name, $this->identity_map)) { $this->identity_map[$class_name] = array(); } $this->identity_map[$class_name][$id] = $entity; }