Add to composer.json following lines
"require": {
"fsi/resource-repository-bundle": "^3.0"
}
Register bundle in bundles.php
// config/bundles.php
<?php
return [
FSi\Bundle\ResourceRepositoryBundle\FSiResourceRepositoryBundle::class => ['all' => true]
];
Create entity that extends base resource model
<?php
declare(strict_types);
namespace FSi\Bundle\DemoBundle\Entity;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Table;
use FSi\Bundle\ResourceRepositoryBundle\Model\Resource as BaseResource;
#[Entity(repositoryClass: "FSi\Bundle\ResourceRepositoryBundle\Doctrine\ResourceRepository"]
#[Table(name: "fsi_resource")]
class Resource extends BaseResource
{
}
# config/packages/fsi_resource_repository.yml
---
fsi_resource_repository:
db_driver: orm
resource_class: FSi\Bundle\DemoBundle\Entity\Resource
Heads up! Although db_driver
option has its default value orm
, you should put it in your
config file to prevent problems with future releases of fsi/resource-repository-bundle.
Update your database schema forcefully:
$ php bin/console doctrine:schema:update --force
or via migrations:
php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate -n
Now you are ready to create Resource Map