Codeception / Codeception/module-doctrine

Method haveInRepository() does not work with readonly property in Embeddable

Đang mở
#2 1 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
PHP
Star
4
Fork
2
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hi, thanks for good library
How I can use method **haveInRepository()** with readonly property,
Example: simple entity with embeddable property

```php
#[Entity]
class User
{
public function __construct(
#[Embedded(class: Address::class)] private Address $address
) {
}

public function getAddres(): Address
{
return $this->address;
}
}

#[Embeddable]
class Address
{
#[Column(type: "string")]
private readonly string $street;

#[Column(type: "string")]
private readonly string $city;
}
```

I want use method **haveInRepository()** for creating test entities like this
```php
$I->haveInRepository(new User(
address: new Address(
street: 'Test street',
city: 'Toronto'
);
);
```

**But got error after run Cest:**
```php
[LogicException] Attempting to change readonly property Address::$street.
```

**How I can fix it? Thanks**

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.