Bug #48551

Doctrine semantical error

Added by Jesper Paardekooper about 2 years ago. Updated about 2 years ago.

Status:Resolved Start date:2013-05-26
Priority:Must have Due date:
Assigned To:- % Done:

100%

Category:Core
Target version:TYPO3 Flow Base Distribution - 2.0
PHP Version: Complexity:
Has patch:No Affected Flow version:Git master

Description

I have a signal&slots implementation for failed login attempts. A repository adds a new Event model everytime this happens.

In Development context this works fine, in Production context it doesn't.

When extending the standard Flow repository, the error is:

Uncaught exception #1337934455 in line 79 of Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Persistence/Repository.php: Could not add object of type "My\App\Domain\Model\Log\Event" 

When extending the doctrine repository, the following exception is thrown:

Uncaught exception in line 640 of Packages/Libraries/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php: [Semantical Error] The annotation "@\TYPO3\Flow\Annotations\Entity" in class My\App\Domain\Model\Log\Event does not exist, or could not be auto-loaded

When debugging the exception the Flow repository throws, it eventually throws the same exception as the doctrine one.

I've tested this on both the current Git master and the beta 3 tag.

Other events that use the same code do work and my model does ofcourse have the correct annotations and use statements.

Associated revisions

Revision ec698a03
Added by Rens Admiraal about 2 years ago

[BUGFIX] Doctrine DocParser ignores Flow autoloader

The Doctrine DocParser does not utilize the autoloaders
registered into spl_autoload. This change registers
the Flow autoloader into Doctrines AnnotionRegistry so
it will be used in the lookup.

The error only occurs in Production context, but
it's hard to say how this change can be verified as
it seems to be very specific when the error occurs
and does not have to occur for all controller /
action combinations in the application.

Change-Id: I8c9e69ba77bbf112a0d1705a3458d746cccfc66d
Resolves: #48551
Releases: master, 2.0

Revision 6e220799
Added by Rens Admiraal about 2 years ago

[BUGFIX] Doctrine DocParser ignores Flow autoloader

The Doctrine DocParser does not utilize the autoloaders
registered into spl_autoload. This change registers
the Flow autoloader into Doctrines AnnotionRegistry so
it will be used in the lookup.

The error only occurs in Production context, but
it's hard to say how this change can be verified as
it seems to be very specific when the error occurs
and does not have to occur for all controller /
action combinations in the application.

Change-Id: I8c9e69ba77bbf112a0d1705a3458d746cccfc66d
Resolves: #48551
Releases: master, 2.0

History

#1 Updated by Sebastian Kurfuerst about 2 years ago

FYI: this bug seems to be also in http://forum.typo3.org/index.php/t/196946/

#2 Updated by Rens Admiraal about 2 years ago

  • Category changed from Annotations to Core
  • PHP Version deleted (5.4)

I've had a similar issue in a project and did some debugging. Turned out that I could make a new instance of the class right after initializeClassLoader() in the Flow bootstrap. Doctrine DocParser fails in loading the class though, and it seems like Doctrine in some way does not use the classloader from Flow. Needs some more investigation.

I removed the PHP version as I know of people having this issue on 5.3 too, target version is ok as this could even be a blocker for the release.

As a DIRTY workaround you can temporary do an include of the classes in your own Package.php or if you've a customized index.php already you can do it there. Keep in mind to remove those includes when the bug is fixed and only use it to keep your project running for now! It's a dirty fix, but better then running in development context ;-)

#3 Updated by Dennis de Jong about 2 years ago

Same issue here as Rens Admiraal, thanks for the (DIRTY!) workaround tip, that seems to work :)

#4 Updated by Gerrit Code Review about 2 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/21132

#5 Updated by Gerrit Code Review about 2 years ago

Patch set 1 for branch 2.0 has been pushed to the review server.
It is available at https://review.typo3.org/21644

#6 Updated by Rens Admiraal about 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF