Skip to content

Commit

Permalink
Update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
accgit authored Aug 14, 2024
1 parent ed93fab commit 5a2d421
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ composer require drago-ex/database

## Use
```php
#[Table('table', 'id')]
#[From('table', 'id')]
class Model {}
```

Expand Down Expand Up @@ -72,7 +72,7 @@ class SampleEntity extends Drago\Database\Entity

Basic repository.
```php
#[Table(SampleEntity::Table, SampleEntity::PrimarKey)]
#[From(SampleEntity::Table, SampleEntity::PrimarKey)]
class Repository {}
```

Expand Down Expand Up @@ -108,5 +108,14 @@ function save(SampleEntity $entity): Result|int|null
}
```

Repository using generics.
```php
/** @extends QueryRowClass<SampleEntity> */
#[From(SampleEntity::Table, SampleEntity::PrimarKey, class: SampleEntity::class)]
class Repository {
use QueryRowClass;
}
```

## Tips
You can also use entities and have them generated. [https://github.com/drago-ex/generator](https://github.com/drago-ex/generator)

0 comments on commit 5a2d421

Please sign in to comment.