2017 © Pedro PelĂĄez
 

symfony-bundle elo-bundle

Integration of the Elo library calculator

image

avoo/elo-bundle

Integration of the Elo library calculator

  • Friday, December 4, 2015
  • by avoo
  • Repository
  • 2 Watchers
  • 0 Stars
  • 26 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

EloBundle

Build Status Scrutinizer Code Quality Latest Stable Version License, (*1)

Elo bundle for Symfony 2, (*2)

Installation

Require avoo/elo-bundle into your composer.json file:, (*3)

``` json { "require": { "avoo/elo-bundle": "~0.1" } }, (*4)


The elo bundle use [`StofDoctrineExtensionsBundle`](https://github.com/stof/StofDoctrineExtensionsBundle) Register the bundle in `app/AppKernel.php`: ``` php // app/AppKernel.php public function registerBundles() { return array( // ... new Avoo\EloBundle\AvooEloBundle(), new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), ); }

Default Configuration

``` yaml, (*5)

app/config/config.yml

Doctrine Configuration

doctrine: orm: auto_generate_proxy_classes: "%kernel.debug%" entity_managers: default: auto_mapping: true mappings: gedmo_loggable: type: annotation prefix: Gedmo\Loggable\Entity dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity" alias: GedmoLoggable # (optional) it will default to the name set for the mappingmapping is_bundle: false, (*6)

stof_doctrine_extensions: orm: default: loggable: true timestampable: true, (*7)


Class implementation -------------------- #### Elo player class **YAML** ``` yml # src/AppBundle/Resources/config/doctrine/EloPlayer.orm.yml AppBundle\Entity\EloPlayer: type: entity table: elo_player id: id: type: integer generator: strategy: AUTO oneToOne: user: targetEntity: AppBundle\Entity\User inversedBy: eloPlayer joinColumn: name: user_id referencedColumnName: id

XML, (*8)

``` xml , (*9)

<entity name="AppBundle\Entity\EloPlayer" table="elo_player">
    <id name="id" type="integer" column="id">
        <generator strategy="AUTO"/>
    </id>
    <one-to-one field="user" target-entity="AppBundle\Entity\User" inversed-by="eloPlayer">
        <join-column name="user_id" referenced-column-name="id" />
    </one-to-one>
</entity>

, (*10)


**Annotation** ``` php namespace Avoo\EloBundle\Entity; use Avoo\EloBundle\Entity\EloPlayer as BaseEloPlayer; use Doctrine\ORM\Mapping as ORM; class EloPlayer extends BaseEloPlayer { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @ORM\OneToOne(targetEntity="AppBundle\Entity\User", inversedBy="eloPlayer") * @ORM\JoinColumn(name="user_id", referencedColumnName="id") */ protected $user; }

Elo versus class

YAML, (*11)

``` yml, (*12)

src/AppBundle/Resources/config/doctrine/EloVersus.orm.yml

AppBundle\Entity\Eloversus: type: entity table: elo_versus id: id: type: integer generator: strategy: AUTO manyToOne: playerA: targetEntity: AppBundle\Entity\EloPlayer joinColumn: name: player_a referencedColumnName: id playerB: targetEntity: AppBundle\Entity\EloPlayer joinColumn: name: player_b referencedColumnName: id, (*13)


**XML** ``` xml <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <entity name="AppBundle\Entity\EloVersus" table="elo_versus"> <id name="id" type="integer" column="id"> <generator strategy="AUTO"/> </id> <many-to-one field="playerA" target-entity="AppBundle\Entity\EloPlayer"> <join-column name="player_a" referenced-column-name="id" /> </many-to-one> <many-to-one field="playerB" target-entity="AppBundle\Entity\EloPlayer"> <join-column name="player_b" referenced-column-name="id" /> </many-to-one> </entity> </doctrine-mapping>

Annotation, (*14)

``` php namespace Avoo\EloBundle\Entity;, (*15)

use Avoo\EloBundle\Entity\EloVersus as BaseEloVersus; use Doctrine\ORM\Mapping as ORM;, (*16)

class EloVersus extends BaseEloVersus { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ protected $id;, (*17)

/**
 * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Player")
 * @ORM\JoinColumn(name="player_a", referencedColumnName="id")
 */
protected $playerA;

/**
 * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Player")
 * @ORM\JoinColumn(name="player_b", referencedColumnName="id")
 */
protected $playerB;

}, (*18)


#### User class **Warning** You need to implement `Avoo/Elo/Model/EloUserInterface` ``` php use Avoo\Elo\Model\EloUserInterface; class User implements EloUserInterface { /** * @var EloPlayerInterface $eloPlayer */ protected $eloPlayer; /** * Get elo player * * @return EloPlayerInterface */ public function getEloPlayer() { return $this->eloPlayer; } }

YAML, (*19)

``` yml, (*20)

src/AppBundle/Resources/config/doctrine/User.orm.yml

AppBundle\Entity\User: type: entity table: elo_user id: id: type: integer generator: strategy: AUTO oneToOne: eloPlayer: targetEntity: AppBundle\Entity\EloPlayer mappedBy: user, (*21)


**XML** ``` xml <entity name="AppBundle\Entity\User" table="elo_user"> <one-to-one field="eloPlayer" mapped-by="user" target-entity="AppBundle\Entity\EloPlayer" /> </entity>

Annotation, (*22)

``` php <?php use Avoo\Elo\Model\EloUserInterface; use Doctrine\ORM\Mapping as ORM;, (*23)

class User implements EloUserInterface { /** * @ORM\OneToOne(targetEntity="AppBundle\Entity\EloPlayer", mappedBy="user") */ protected $eloPlayer; }, (*24)


Default Usage ------------- ``` php use Avoo\Elo\EloPoint; use Avoo\Elo\Model\EloVersusInterface; use Avoo\Elo\Model\EloAggregationInterface; /** @var EloPoint $calculator */ $calculator = $this->get('avoo_elo.calculator'); /** @var EloVersusInterface $match */ $calculator->calculate($match); /** @var EloAggregationInterface $aggregation */ $aggregation = $calculator->getAggregation();

License

This bundle is released under the MIT license. See the complete license in the bundle:, (*25)

License, (*26)

The Versions

04/12 2015

dev-master

9999999-dev

Integration of the Elo library calculator

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jérémy Jégou

elo rewards competition points rank

04/12 2015

0.1.0

0.1.0.0

Integration of the Elo library calculator

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jérémy Jégou

elo rewards competition points rank