2025-08-06 18:10:04 +03:00

44 lines
1.2 KiB
PHP

<?php
/**
* Отключаю несущественные инспекции (из-за Attribute)
*
* @noinspection PhpMultipleClassDeclarationsInspection
*/
namespace goodboyalex\php_db_components_pack\attributes;
use Attribute;
/**
* Атрибут указывающий имя поля в БД.
*
* @author Александр Бабаев
* @package php_db_components_pack
* @version 1.0
* @since 1.0
*/
#[Attribute(flags: Attribute::TARGET_PROPERTY)]
final readonly class ForeignKey
{
/**
* @var string $TableName Имя таблицы.
*/
public string $TableName;
/**
* @var string $FieldName Имя связываемого поля.
*/
public string $FieldName;
/**
* Конструктор.
*
* @param string $table Имя таблицы.
* @param string $fieldName Имя связываемого поля.
*/
public function __construct (string $table, string $fieldName)
{
$this->TableName = $table;
$this->FieldName = $fieldName;
}
}