web-base/Core/Objects/DatabaseEntity/Attribute/MultipleReference.class.php

32 lines
896 B
PHP
Raw Normal View History

2023-01-10 22:12:05 +01:00
<?php
namespace Core\Objects\DatabaseEntity\Attribute;
// Managed NM table, e.g. #[MultipleReference(Y::class, "x", "z")] in X::class will use
// the table of Y::class and lookup values by column "x_id" and create an array with keys of "z_id" holding a reference of Y
2023-01-10 22:12:05 +01:00
#[\Attribute(\Attribute::TARGET_PROPERTY)]
class MultipleReference {
private string $className;
private string $thisProperty;
private string $relProperty;
2023-01-11 18:47:12 +01:00
public function __construct(string $className, string $thisProperty, string $relProperty = "id") {
2023-01-10 22:12:05 +01:00
$this->className = $className;
$this->thisProperty = $thisProperty;
$this->relProperty = $relProperty;
}
public function getClassName(): string {
return $this->className;
}
public function getThisProperty(): string {
return $this->thisProperty;
}
public function getRelProperty(): string {
return $this->relProperty;
}
}