Coder Social home page Coder Social logo

sulu-backend-bundle's Introduction

SULU Backend Bundle

Inspired by doctrine crud generator.

A Sulu Bundle to make it easier to create a new Backend Bundle.

With this Bundle it should be possible to create a Backend Bundles without the knowledge of husky the sulu javascript framework.

Installation

composer require l91/sulu-backend-bundle

Add Bundle to AdminKernel

$bundles[] = new L91\Sulu\Bundle\BackendBundle\L91SuluBackendBundle();

Usage

As example we will create a API for an entity called Vehicle.

1. Create Entity

First create the doctrine entity with a .orm.xml.

2. Create Repository

Create a Repository for loading entities from the database. The BackendRepository have a default implementation for them:

  • findById
  • findAll
  • count

Create the functions in your repository or extend from the BackendRepository.

<?php

namespace YourBundle\Entity\Repository;

use L91\Sulu\Bundle\BackendBundle\Entity\Repository\BackendRepository;

class VehicleRepository extends BackendRepository
{
    // Add your custom repository functions here
}

Register Repository

services:
    your.repository.vehicle:
        class: YourBundle\Entity\VehicleRepository
        factory_service: doctrine.orm.entity_manager
        factory_method: getRepository
        arguments:
            - YourBundle\Entity\Vehicle

4. Generate Controller, Manager, Admin Navigation or Tab, JSBundle

You can easily generate them with following command:

app/console l91:sulu:backend:generate:crud YourBundle:Vehicle --route-format yml --service-format yml

Add --extended to have no requirements to this Bundle. This will generate a complete own Controller, Manager, ... when use the extended generation you could remove this bundle from your requirements after you generated your bundle.

Command List

You can also just generate a specific part with the following commands:

  • app/console l91:sulu:backend:generate:controller
  • app/console l91:sulu:backend:generate:manager
  • app/console l91:sulu:backend:generate:admin
  • app/console l91:sulu:backend:generate:js
  • app/console l91:sulu:backend:generate:navigation-provider

sulu-backend-bundle's People

Contributors

alexander-schranz avatar michelfalke avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.