ablaise/meteion-bundle

MeteionBundle is a Symfony integration of the Meteion library.

1.0.1 2022-05-02 15:15 UTC

This package is auto-updated.

Last update: 2024-05-12 23:01:01 UTC


README

MeteionBundle is a Symfony integration of the Meteion library.

Key features

  • Auto-configuration
  • Commands
  • Services
  • Entities

Installation

First, you need to enable the recipes (contrib) using the following command.

composer config extra.symfony.allow-contrib true

Then add MeteionBundle using the following command.

composer require ablaise/meteion-bundle

Getting Started

Environment Variable

You only need to fill in the environment variable METEION_RAWEXD_PATH which indicates the location of the rawexd directory extracted using SaintCoinach.

###> ablaise/meteion-bundle ###
METEION_RAWEXD_PATH="/path/to/rawexd"
###< ablaise/meteion-bundle ###

Configuration

You can leave the default settings unless you need to specify a different dbal connection.

# config/packages/meteion.yaml
meteion:
    dbal_connection: 'default'
    rawexd_path: '%env(string:METEION_RAWEXD_PATH)%'

Command

Once you have defined your DATABASE_URL connection, you can simply create the associated database and run Meteion using the following commands.

php bin/console doctrine:database:create

php bin/console meteion:run

Remember to allocate enough resources to your server before running the meteion:run command.

Meteion As A Service

The MeteionManager service allows you to use Meteion without additional configuration using dependency injection.

public function meteion(MeteionManager $manager)
{
    $manager->run();

    // ...
}

Ready to use Entities

Entities are available under the namespace MeteionBundle\Entity.

use MeteionBundle\Entity\Quest;

public function meteion(ManagerRegistry $doctrine)
{
    $quest = $doctrine->getRepository(Quest::class)->findOneBy(['name' => 'Coming to Gridania']);

    // ...
}

Linking subfolders metadata

Entities with the Metadata suffix contained in the subfolders can be linked using the referenceTable field.

use MeteionBundle\Entity\Quest;
use MeteionBundle\Entity\QuestMetadata;

public function meteion(ManagerRegistry $doctrine)
{
    $quest = $doctrine->getRepository(Quest::class)->findOneBy(['name' => 'Coming to Gridania']);
    if (false !== $quest) {
        $dialogs = $doctrine->getRepository(QuestMetadata::class)->findBy(['referenceTable' => $quest->getId()], ['pk' => 'ASC']);
    }
    
    // ...
}

What's next?

  • New entity-related services
  • Improved commands