PHPackages                             skwi/project-base-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. skwi/project-base-bundle

ActiveLibrary

skwi/project-base-bundle
========================

Bundle with base code for projects

2.5(7y ago)02.7kMITPHPPHP &gt;=5.3.0

Since Dec 20Pushed 7y ago1 watchersCompare

[ Source](https://github.com/skwi/SkwiProjectBaseBundle)[ Packagist](https://packagist.org/packages/skwi/project-base-bundle)[ Docs](http://github.com/skwi/SkwiProjectBaseBundle)[ RSS](/packages/skwi-project-base-bundle/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)Dependencies (9)Versions (5)Used By (0)

Deprecated Alert
================

[](#deprecated-alert)

> This bundle is not maintained anylonger because it violates several SOLID principles.

SkwiProjectBaseBundle
=====================

[](#skwiprojectbasebundle)

[![Build Status](https://camo.githubusercontent.com/11d4ab3c1c1c96c1e3998da34b85341f31ea66ecd9f875313a0a9895eb87dd04/68747470733a2f2f7472617669732d63692e6f72672f736b77692f536b776950726f6a6563744261736542756e646c652e737667)](https://travis-ci.org/skwi/SkwiProjectBaseBundle)

This is a bundle with some basic code I often use in my projects. Feel free to use it or enhance it.

Compatibility
-------------

[](#compatibility)

The current version of the bundle is only compatible with Symfony 2.5+ Version 1.0 provides compatibility with older versions of Symfony

Setup
-----

[](#setup)

### Install SkwiProjectBaseBundle

[](#install-skwiprojectbasebundle)

Simply run assuming you have installed composer (composer.phar or composer binary) :

```
php composer.phar require skwi/project-base-bundle "dev-master"
```

### Configuration

[](#configuration)

Register the bundle in `app/AppKernel.php`:

```
// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new \Skwi\Bundle\ProjectBaseBundle\SkwiProjectBaseBundle(),
    );
}
```

In your *app/config.yml* file, you may need to set up several parameters

```
skwi_project_base:
    entity_bundle_name: FooBarBundle # Default bundle when extending BaseManager (see below)
    entity_bundle_namespace: \Foo\Bundle\BarBundle # Default bundle namespace
    password_encoder: sha512 # Password encoder method
    pager_max_per_page: 10 # Default max items per page when using paginator in the BaseManager
    kernel_root_dir: %kernel.root_dir%
```

Usage
-----

[](#usage)

### Base Manager

[](#base-manager)

This abstract class provides methods for object managed by Doctrine ORM or Doctrine ODM and MongoDb.

#### Philosophy

[](#philosophy)

The idea is to extends this class to manage a specific entity. Other entities can be managed by an single manager but the `$objectName` and `$repository` property will be used for a default managed entity.

#### Project setup

[](#project-setup)

It's recommended for a manager extend the class and to be injected as a service.

```
# service.yml
mybundle.manager.poney :
        class  : 'Foo\\Bundle\\BarBundle\\Manager\\PoneyManager'
        parent : skwi.projectbase.base_manager
        calls  :
            - [setObjectManager, [@doctrine.orm.entity_manager]]
            - [setObject, ['FooBarBundle:Poney']]
```

```
