TYPO3 Domain model matrix array for different properties possible somehow?

46 views Asked by At

Is it possible to make a relation between 2 properties with the domain model? Maybe it's a stupid question but i have a "theme" property:

/**
 * thema
 *
 * @var int
 */
protected $thema = 0;

/**
 * Returns the thema
 *
 * @return int
 */
public function getThema()
{
    return $this->thema;
}

/**
 * Sets the thema
 *
 * @param int $thema
 * @return void
 */
public function setThema(int $thema)
{
    $this->thema = $thema;
}

And I would like to make a new "project" property, which is related with the old thema.

like:

/**
 * project
 *
 * @var int
 */
protected $project = 0;

/**
 * Returns the project
 *
 * @return int
 */
public function getProject()
{
    return $this->project;
}

/**
 * Sets the project
 *
 * @param int $project
 * @return void
 */
public function setProject(int $project)
{
    $this->project = $project;
}

/**
 * thema
 *
 * @var int
 */
protected $thema = 0;

/**
 * Returns the thema
 *
 * @return int
 */
public function getThema()
{
    return $this->thema;
}

/**
 * Sets the thema
 *
 * @param int $thema
 * @return void
 */
public function setThema(int $thema)
{
    switch ($this->project) {
    case 0:
        $this->thema = 3;
        break;

    case 1:
        $this->thema = 2;
        break;

    case 2:
        $this->thema = 1;
        break;
    
    default:
        $this->thema = 0;
        break;
    }
}

So I can set the theme to a value related to the project

Is this somehow possible?

Thanks in advance

0

There are 0 answers