# AutoAdmin Library

## Documentation && Changelog

[link to documentation](./docs/index.md)

[link to changelog](./CHANGELOG.md)

## Installation

```bash
composer create-project symfony/skeleton:"6.4.*" <my_project_directory>
cd <my_project_directory>
composer require webapp
composer require -W doctrine/orm:^2.6.3
composer remove symfony/asset-mapper

composer config repositories.satis composer https://satis.gda.fr
composer config extra.symfony.endpoint --json '["https://satis.gda.fr/recipes/index.json", "flex://defaults"]'

composer require -W gda/autoadmin
```

### How to start

Create your first site and your first administrator

```bash
php bin/console aa:content:create-site
php bin/console aa:admin:create-administrator
```

---------------------------

## For development

### Work in local

For local development, add this to the "repositories" composer.json section:
```json
{
    "type": "path",
    "url": "../aa-bundle"
}
```
and run
```bash
rm -rf ./vendor/gda/autoadmin && composer update gda/autoadmin
```

> [!IMPORTANT]
> When you install the autoadmin dependencies, please run `composer install --prefer-lowest` to make sure that the bundle is compatible with all the versions of the dependencies.

You can use `yarn watch` and `yarn build` to update/work the assets in local, remember to make `yarn build` before you push a new version of the bundle.

Use this command to symlink a project vendor to the local autoadmin bundle to avoid package version error:

```bash
ln -s /home/gda223/PhpstormProjects/your-project-with-autoadmin/vendor/ /home/gda223/PhpstormProjects/autoadmin-project
```

### Update bundle

When pushed on the "master" branch, the bundle will automatically be updated on https://satis.gda.fr/, wait a few seconds to let satis update the files.

And for update in your project, run the next command; it will update composer.json and composer.lock

```bash
rm -rf ./vendor/gda/autoadmin && composer update gda/autoadmin
```

### Using rsync to bind a project vendor with AA

```bash
watch -n 1 'rsync -rva --delete ./src/ ../AAA-site/vendor/gda/autoadmin/src'
```


### List last git version tags

```bash
bash ./scripts/git/last_tags.sh
```


# Notes

We use phpunit ^9.5 because symfony 6.4 is using this.
