Skip to content

Commit

Permalink
đź“ť improve docs and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
garak committed Jan 18, 2025
1 parent 3377f7a commit 4cb007b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 35 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ jobs:
php: '8.1'
- description: 'No Symfony specified'
php: '8.2'
- description: 'No Symfony specified'
php: '8.3'
- description: 'No Symfony specified'
php: '8.4'
- description: 'Lowest deps'
php: '8.1'
composer_option: '--prefer-lowest'
Expand All @@ -41,11 +45,11 @@ jobs:
php: '8.1'
symfony: 5.4.*
- description: 'Symfony 6.4'
php: '8.2'
php: '8.3'
symfony: 6.4.*
- description: 'Latest'
php: '8.3'
symfony: 7.0.*
php: '8.4'
symfony: 7.1.*
name: PHP ${{ matrix.php }} tests (${{ matrix.description }})
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"symfony/http-kernel": "^5.4 || ^6.0 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^10.5 || ^11.3"
"phpunit/phpunit": "^10.5 || ^11.5"
},
"config": {
"bin-dir": "bin",
Expand Down
47 changes: 16 additions & 31 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
Documentation
=============
# Documentation

## Installation

Run from terminal:
Run from a terminal:

```bash
$ composer require pugx/shortid-doctrine-bundle
composer require pugx/shortid-doctrine-bundle
```

If you don't use Flex, you need to manually enable bundle in your kernel:

```php
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = [
// ...
new PUGX\Shortid\Doctrine\Bundle\PUGXShortidDoctrineBundle(),
];
}
```
The bundle should be automatically enabled and configured by Flex.
If not, remember to enable the bundle in you kernel.

## Usage

Expand All @@ -34,19 +22,16 @@ Example:
namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use PUGX\Shortid\Doctrine\Generator\ShortidGenerator;

/**
* @ORM\Entity()
* @ORM\Table()
*/
#[ORM\Entity]
#[ORM\Table]
class Book
{
/**
* @ORM\Column(type="shortid")
* @ORM\Id
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class="PUGX\Shortid\Doctrine\Generator\ShortidGenerator")
*/
#[ORM\Column(type: 'shortid')
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'CUSTOM')
#[ORM\CustomIdGenerator(class: ShortidGenerator::class)
protected $id;
}
```
Expand All @@ -62,13 +47,13 @@ pugx_shortid_doctrine:
alphabet: "é123456789àbcdefghìjklmnòpqrstùvwxyzABCDEFGHIJKLMNOPQRSTUVWX.!@|"
```
The `length` option must be between 2 and 20 (default is 7), while `alphabet` must be 64 characters long.
The `length` option must be between 2 and 20 (the default value is 7), while the `alphabet` must be 64 characters long.

>Be aware: if you change `length` in this way, you **must** specify `length` option in every column definition.
>Moreover, you'll need to manually set column definition for ManyToOne mappings.
>Be aware: if you change the `length` in this way, you **must** specify the `length` option in every column definition.
>Moreover, you'll need to manually set the column definition for ManyToOne mappings.
>For example: `<join-column column-definition="CHAR(8) COLLATE utf8_bin NOT NULL"/>`

You can also configure `readable` option instead of `alphabet`. Example:
You can also configure the `readable` option instead of `alphabet`. Example:

```yaml
pugx_shortid_doctrine:
Expand Down

0 comments on commit 4cb007b

Please sign in to comment.