GithubHelp home page GithubHelp logo

msd007 / corebundle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sideclick/corebundle

0.0 2.0 0.0 155 KB

This is a Symfony Bundle compatible with Symfony 2.6+ which provides several features we consider core here at Sideclick.

License: MIT License

PHP 81.63% HTML 18.37%

corebundle's Introduction

Sideclick CoreBundle

This is a Symfony Bundle compatible with Symfony 2.6+ which provides several features which are commonly required in Symfony projects.

Installation

Step 1: Add the following to the "require" section of composer.json

"sideclick/core-bundle": "dev-master"

Step 2: Enable the bundle

Enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Sideclick\CoreBundle\SideclickCoreBundle(),
    );
}

Step 3: Install additional Bundles

This Bundle requires that other bundles be installed and configured, these are:

Step 3.1 Configuring FOSMessageBundle

When configuring FOSMessageBundle, start with this:

fos_message:
    db_driver: orm
    thread_class: Sc\CoreBundle\Entity\Thread
    message_class: Sc\CoreBundle\Entity\Message

You will need to install and configure these before being able to use this Bundle.

Features

1. Entity Helpers

Entity helper classes should be defined in the /Entity/Helper directory, here is the basic structure of an Entity Helper class for an entity named 'User':

<?php
//Sideclick\CoreBundle\Entity\Helper\UserHelper.php

namespace Sideclick\CoreBundle\Entity\Helper;

use Sideclick\CoreBundle\Entity\Helper\HelperAbstract;
use Sideclick\CoreBundle\Entity\User;

class UserHelper extends HelperAbstract
{
    protected $_user;

    public function setUser(User $user)
    {
        $this->_user = $user;
    }
    
}

There is a service named sc_core.entity_helper_factory which makes it easy to get an instance of an Entity Helper for an object, for example, in your controller you could do:

$userHelper = $this->get('sc_core.entity_helper_factory')->getEntityHelper($user);

Also, there is a twig function to get a helper in your templates:

get_entity_helper(user)

More documentation to come...

corebundle's People

Contributors

msd007 avatar rowanreid avatar

Watchers

 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.