Answer the question
In order to leave comments, you need to log in
How to define constants for Entity?
I have a doctrine entity class defined in my project
use Doctrine\ORM\Mapping as ORM;
/**
* Filter
*
* @ORM\Table(name="")
* @ORM\Entity
*/
class Filter
{
... :
class: некий класс
tags:
- { name: ezpublish_rest.output.value_object_visitor, type: здесь нужно указать какого типа класс }
class Collection {
public $items;
}
Answer the question
In order to leave comments, you need to log in
You can use the approach: ValueObject. This is a class with a constructor and one getter. All he can do is contain 1 value.
In an entity, you write a setter with type hinting on VO. At the same time, in the entity field, write the value from vo. In the getter, you create a new VO instance based on the value.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question