[BUGFIX] Do not treat all classes as entities in ClassSchema 06/59806/2
authorAlexander Schnitzler <git@alexanderschnitzler.de>
Mon, 4 Feb 2019 09:03:08 +0000 (10:03 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Thu, 7 Mar 2019 19:45:18 +0000 (20:45 +0100)
The ClassSchema class has a property $modelType which indicates
that a class is either an entity or a value object. This property
has a default value that reflected the state of an entity.

This means, that all classes, class schemata are created for are
considered entities which then leads to the execution of further
entity related analysis code, such as looking for specific doc
blocks and/or annotations.

While this isn't an issue functionality wise, it can be in the future.
Also, the superfluous cpu cycles can and should be spared.

Releases: master, 9.5
Resolves: #87632
Change-Id: I15f7688b8bf1ac9486d77a0efc38ccb07a397b30
Reviewed-on: https://review.typo3.org/c/59806
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/extbase/Classes/Reflection/ClassSchema.php
typo3/sysext/extbase/Tests/Unit/Reflection/ClassSchemaTest.php
typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyClassWithAllTypesOfProperties.php

index acbcb3b..1dd9a30 100644 (file)
@@ -78,7 +78,7 @@ class ClassSchema
      *
      * @var int
      */
-    protected $modelType = self::MODELTYPE_ENTITY;
+    protected $modelType = 0;
 
     /**
      * Whether a repository exists for the class this schema is referring to
index de1a3c3..1d767f6 100644 (file)
@@ -66,6 +66,11 @@ class ClassSchemaTest extends UnitTestCase
                 'propertyWithCascadeAnnotationWithoutVarAnnotation',
                 'propertyWithObjectStorageAnnotation',
                 'propertyWithObjectStorageAnnotationWithoutFQCN',
+                'uid',
+                '_localizedUid',
+                '_languageUid',
+                '_versionedUid',
+                'pid',
             ],
             array_keys((new ClassSchema(Fixture\DummyClassWithAllTypesOfProperties::class))->getProperties())
         );
index bfa9128..3876c69 100644 (file)
@@ -16,12 +16,13 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture;
 
 use TYPO3\CMS\Extbase\Annotation as Extbase;
 use TYPO3\CMS\Extbase\Annotation\ORM\Transient;
+use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
 use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
 
 /**
  * Fixture class with getters and setters
  */
-class DummyClassWithAllTypesOfProperties
+class DummyClassWithAllTypesOfProperties extends AbstractEntity
 {
     public $publicProperty;