Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed classIsNotAValidEntity problem #102

Closed
wants to merge 1 commit into from

3 participants

@grizlik

I don't know how it works earlier, but after update symfony and all Doctrine packages I have a headache on my production server: AnnotationDriver throws exception classIsNotAValidEntityOrMappedSuperClass, because in this code
// Compatibility with Doctrine Common 3.x
if ($classAnnotations && is_int(key($classAnnotations))) {
foreach ($classAnnotations as $annot) {
$classAnnotations[get_class($annot)] = $annot;
}
}
key($classAnnotations) returns null, because annotations readed from cache and internal pointer is set to last element! In development all works fine, because annotations is readed from file, not from cache.
I resolve this problem adding code reset($data) to CachedReader, but has many ways for resolve that

@grizlik

Maybe someone answer to my pull request? If it is not needed, tell me about it. I have a problem with ApcCache.

@stof
Collaborator

@grizlik can you write a unit test showing the issue (meaning it should fail with the current code and pass with your fix) ?

@stof
Collaborator

@grizlik ping

@grizlik

i will try to do this some later. I'm sorry, but i have not enough time now :(

@Ocramius
Owner

@grizlik news?

@grizlik

hi. i have some problems with it, because exception throws in Doctrine/ORM/Mapping/Driver/AnnotationDriver.php (in doctrine-orm project), but "seat of the trouble" located in Doctrine/Common/Annotations/CachedReader.php (doctrine-common project). where i write the test?

@Ocramius
Owner

@grizlik I think the failing test should be written in common. The ORM is throwing the exception, but it depends on this problem as it seems.

@Ocramius
Owner

Annotations have been moved to https://github.com/doctrine/annotations - if this is still a problem, please open a PR against that repo.

@Ocramius Ocramius closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 7, 2012
  1. @grizlik
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 0 deletions.
  1. +1 −0  lib/Doctrine/Common/Annotations/CachedReader.php
View
1  lib/Doctrine/Common/Annotations/CachedReader.php
@@ -73,6 +73,7 @@ public function getClassAnnotations(\ReflectionClass $class)
// Attempt to grab data from cache
if (($data = $this->cache->fetch($cacheKey)) !== false) {
if (!$this->debug || $this->isCacheFresh($cacheKey, $class)) {
+ reset($data);
return $data;
}
}
Something went wrong with that request. Please try again.