Giter Club home page Giter Club logo

symfony_playground's Introduction

Symfony playground

An Uvinum project to play around Symfony framework.

For now, let's use the built-in PHP webserver Symfony provide us using: bin/console server:run

We've modelled a User (Aggregate Root) that can learn new Skills.

The App implements a CommandBus and Event management. The controllers execute the needed Command sending it to the CommandBus, who will match it with its CommandHandler.

We have two CommandBus middlewares (DBTransactionality and EventAware) that will ensure the Commands transactionality, and the Events management (all events generated in the models will be stored during the Command execution, and will be handled / dispatched if the transaction went OK).

There are three example implementations for the User aggregate repository. One using Doctrine ORM and the Domain Entities (Playground\App\Infrastructure\Repository\Doctrine\User\UserOrmRepository), another one using Doctrine ORM and separating Domain Entities from Doctrine Entities (Playground\App\Infrastructure\Repository\Doctrine\User\UserOrmEntitiesRepository) and another one using raw DBAL connection (Playground\App\Infrastructure\Repository\Doctrine\User\UserDbalRepository).

In the ORM cases, we don't extend directly from the Doctrine repos. Instead of this, we inject the Doctrine Manager Registry to our repo, so we can decouple from Doctrine's implementation and prevent our app to access all public methods available on Doctrine repos. In this direction, the UserOrmEntitiesRepository is a test to see if we could keep our domain entities totally decoupled from Doctrine, even for those properties that "map" other entities as relations (ArrayCollections and so).

All Doctrine ORM mapping config files will be found on src/Playground/App/Infrastructure/Repository/Doctrine/_mapping/*.yml

You can re-create the needed schema (the app is configured to use sqlite, so you don't need to install or run MySQL or any other DB) with the following commands:

  • bin/console doctrine:database:drop --force (in order to remove any previous DB in the project)
  • bin/console doctrine:schema:update --force (in order to create the SQL schema)

The first time you execute a composer install your own parameters.yml will be created based on parameters.yml.dist values.

You can use the PHP webserver to run and test the application, executing bin/console server:start

Go & play. ;-)

symfony_playground's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.