friendsofsulu/maker-bundle

Package to generate configuration and boilerplate code in Sulu

dev-master 2024-07-16 13:04 UTC

This package is auto-updated.

Last update: 2024-11-16 17:28:04 UTC


README

This package adds makers for Sulu Configurations (eg. list or form XML) but can also generate Controller and Admin PHP classes.

How to install

Installing it with composer is very easy:

composer require --dev friendsofsulu/maker-bundle

How to use

This plugin needs the configuration directory of Sulu to be under %kernel.project_dir%/config/ which for a standard Sulu installation is the case.

Example Usage

Create an entity (either manually or with the symfony maker bundle included here).

<?php

declare(strict_types=1);

namespace App\Entity;

class Changelog
{
    public static $RESOURCE_KEY = 'changelog';
    // or...
    public const RESOURCE_KEY = 'changelog';

    public ?int $id = null;
    public string $name = '';
    public string $description = '';
}

Then you can create a list configuration for this entity bin/console make:sulu:list App\\Entity\\Changelog. This will ask for every property if it should be visible and if it is should be searchable. Looking like this: Image

Most of the values have defaults so just hitting enter on most of them works.

Feature List

Here is a list of features this maker provides.

Generating the List XML Configruation make:sulu:list

The basics for this are working. This can't generate a configuration for entities with join columns.

Generating form XML configuration make:sulu:form

TODO

Generating an admin class for an entity sulu:make:admin

Basic generation is working. You can also disable parts of the view generation (generating a view without the edit form).

Generating a controller sulu:make:controller

You can generate a controller with get, delete and update actions or any combination of those. And it even has some helpful tips on avoiding pitfalls with _ in the resource key.

Generate all of the above sulu:make:resource

TODO