[BUGFIX] Do not treat all classes as entities in ClassSchema 28/59628/3
authorAlexander Schnitzler <git@alexanderschnitzler.de>
Mon, 4 Feb 2019 09:03:08 +0000 (10:03 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 23 Feb 2019 18:24:09 +0000 (19:24 +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: If4bc79b9761ee28ffd9e2f25924588140310c0fa
Reviewed-on: https://review.typo3.org/c/59628
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-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 4aa4860..9136fd9 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;