Issue Bug Under Review Stale

#106483Exception 1546632293 Could not get value of property [model] make sure the property is either public or has a getter

Lina Wolf 04/02/25, 08:01 updated 08/06/26, 16:02

Description

This exception is also thrown when the extbase model has a public getter and or the property is public but the TCA for the field is missing.

Can we detect this case and give a more specific error message? If not I would suggest to change the error message to also include TCA

Reviews 1

History 914

  1. S P commented <span data-processor="relativetime" data-value="2025-04-25T10:18:56+00:00" > 04/25/25, 10:18 </span>

    I found this issue while just researching for an undocumented(?) breaking change in behaviour after upgrading from v11 to v12.

    Why isn’t it possible to call property- less methods from Fluid anymore? From our POV this is a massive breaking change.

    We often access domain model methods in Fluid that have no underlying property (or TCA entry) at all. Just to separate logic from view.

    The following example worked totally fine up to TYPO3 11. In TYPO3 12 it stopped working without any changelog/deprecation/migration documentation or warning and throws the mentioned exception. This basically degrades domain models to simple DTOs if they are not allowed to have any self-relating logic inside them which can be passed on to the view. And to prevent this discussion: no, this is no case for a ViewHelper, because of course a model is totally allowed to know/calculate everything it can about itself and pass it on to the View. That’s the one single essence of DDD MVC architecture. A ViewHelper is used for domain-external formatting/data-retrieval.

    Now the example (worked in v11, throws this exception in v12):
    Fluid:

    {product.something}
    <f:for each="{product.things}" as="thing">
    </f:for>

    PHP Model Product:

    final class Product extends AbstractEntity
    {
        // <snip> all the regular TCA-bound stuff
    
        // this method has no property or TCA entry at all!
        public function getSomething(): string
        {
            // here calculate complicated stuff only from $this state and put it into $result
            return $result;
        }
    
        // this method has no property or TCA entry at all!
        public function getThings(): array
        {
            // here retrieve complicated array stuff only from $this state and put it into $result
            return $result;
        }
    }
  2. Georg Ringer commented <span data-processor="relativetime" data-value="2025-04-25T10:35:41+00:00" > 04/25/25, 10:35 </span>

    Getters can still be called, see e.g. https://github.com/georgringer/news/blob/main/Classes/Domain/Model/News.php#L384-L391 ext:news models got a lot of additional methods which are called via fluid, in v12/v13 working. so your issue might be something else!

  3. Lina Wolf commented <span data-processor="relativetime" data-value="2025-04-25T14:32:57+00:00" > 04/25/25, 14:32 </span>

    If a property cannot be persisted, it needs to be marked as transient [Transient](https://docs.typo3.org/permalink/t3coreapi:extbase-annotation-transient) then Extbase expects not TCA definition

  4. S P commented <span data-processor="relativetime" data-value="2025-04-25T16:40:08+00:00" > 04/25/25, 16:40 </span>

    Lina Wolf wrote in #note-5:
    > If a property cannot be persisted, it needs to be marked as transient [Transient](https://docs.typo3.org/permalink/t3coreapi:extbase-annotation-transient) then Extbase expects not TCA definition

    I was talking about plain methods named getSometing() , not properties.

    Georg Ringer wrote in #note-4:
    > Getters can still be called, see e.g. https://github.com/georgringer/news/blob/main/Classes/Domain/Model/News.php#L384-L391 ext:news models got a lot of additional methods which are called via fluid, in v12/v13 working. so your issue might be something else!

    Interesting. Need to investigate further, then.

    Still, something (probably undocumented) between v11 and v12 regarding this behaviour changed/got more strict, if we now get this hard failing Exception when previously everything worked without any warning at all.

  5. S P commented <span data-processor="relativetime" data-value="2025-04-28T05:57:33+00:00" > 04/28/25, 05:57 </span>

    Did some further analysis and could narrow it down to a very specific situation. The exception occurs if the model has any ObjectStorage that is not TCA-bound, even if it is not called by Fluid and even if it is private! Marking such a property as #[\TYPO3\CMS\Extbase\Annotation\ORM\Transient] did not help. It is enough for the Exception to be thrown if the property exists when Extbase constructs the instance.

    It seems for PHP built-in typed non-TCA properties (like int or array) this Exception is not thrown, after all. And it seems also not to happen for Domain-typed properties (like private Domain\Model\Product $product). It seems only to be thrown for non-TCA-bound ObjectStorage.

    Some of our non-property methods store results in private properties (for runtime-caching). The ones being ObjectStorage are the ones that throw the exception. In our case I luckily can convert them easily to plain arrays.

    A trimmed down example:

    final class Product extends AbstractEntity
    {
        // The pure existance of this line causes the exception! No matter if called from anyhwere or not.
        private ObjectStorage $nonTcaBoundObjectStorage;
    }

    This still sounds like a real bug to me (a less drastic one, now, but still not just an unclear Exception message). I totally expect models to be able to have any properties of any type, especially protected/private ones. Why does Extbase in v12 care about whether a protected/private ObjectStorage is DB/TCA-bound? That still is an undocumented regression and it seems totally random to have this behaviour just for ObjectStorage (and not for either none or all possible types).

  6. S P commented <span data-processor="relativetime" data-value="2025-06-11T05:23:39+00:00" > 06/11/25, 05:23 </span>

    I added a relation #105843 because there’s another curious problem with ObjectStorages (language overlay in ObjectStorage does not work reliably).