2017 © Pedro Peláez
 

library float

Enumeration type for Doctrine - floats only

image

doctrineum/float

Enumeration type for Doctrine - floats only

  • Wednesday, July 18, 2018
  • by jaroslavtyc
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5,842 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 3 % Grown

The README.md

Doctrine Float enum

Build Status Test Coverage License, (*1)

About

Adds Enum to Doctrine ORM (can be used as a @Column(type="float_enum"))., (*2)

Usage

<?php

use Doctrine\ORM\Mapping as ORM;
use Doctrineum\Float\FloatEnum;

/**
 * @ORM\Entity()
 */
class Person
{
    /**
     * @var int
     * @ORM\Id() @ORM\GeneratedValue(strategy="AUTO") @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @var FloatEnum
     * @ORM\Column(type="float_enum")
     */
    private $height;

    public function __construct(FloatEnum $height)
    {
        $this->height = $height;
    }

    /**
     * @return FloatEnum
     */
    public function getHeight()
    {
        return $this->height;
    }
}

$tallMan = new Person(FloatEnum::getEnum(197.45));

/** @var \Doctrine\ORM\EntityManager $entityManager */
$entityManager->persist($tallMan);
$entityManager->flush();
$entityManager->clear();

/** @var Person[] $persons */
$canSitOnFrontSeat = $entityManager->createQuery(
    "SELECT p FROM Person p WHERE p.height >= 140"
)->getResult();

var_dump($canSitOnFrontSeat[0]->getHeight()->getValue()); // 197.45;

Installation

Add it to your list of Composer dependencies (or by manual edit your composer.json, the require section), (*3)

composer require jaroslavtyc/doctrineum-float

Doctrine integration

Register new DBAL type:, (*4)

<?php

use Doctrineum\Float\FloatEnumType;

FloatEnumType::registerSelf();

When using Symfony with Doctrine you can do the same as above by configuration:, (*5)

# app/config/config.yml

# Doctrine Configuration
doctrine:
    dbal:
        # ...
        mapping_types:
            float_enum: float_enum
        types:
            float_enum: Doctrineum\Float\FloatEnumType

The Versions

18/07 2018

dev-master

9999999-dev

Enumeration type for Doctrine - floats only

  Sources   Download

MIT

The Requires

 

The Development Requires

18/07 2018

3.1.x-dev

3.1.9999999.9999999-dev

Enumeration type for Doctrine - floats only

  Sources   Download

MIT

The Requires

 

The Development Requires

18/07 2018

3.1.0

3.1.0.0

Enumeration type for Doctrine - floats only

  Sources   Download

MIT

The Requires

 

The Development Requires

19/02 2017

3.0.x-dev

3.0.9999999.9999999-dev

Enumeration type for Doctrine - floats only

  Sources   Download

MIT

The Requires

 

The Development Requires

19/02 2017

3.0.0

3.0.0.0

Enumeration type for Doctrine - floats only

  Sources   Download

MIT

The Requires

 

The Development Requires

16/11 2015

2.0.x-dev

2.0.9999999.9999999-dev

Enumeration type for Doctrine - floats only

  Sources   Download

MIT

The Requires

 

The Development Requires

06/11 2015

2.0.0

2.0.0.0

Enumeration type for Doctrine - floats only

  Sources   Download

MIT

The Requires

 

The Development Requires

17/07 2015

1.0.x-dev

1.0.9999999.9999999-dev

Enumeration type for Doctrine - floats only

  Sources   Download

MIT

The Requires

 

The Development Requires

17/07 2015

1.0.1

1.0.1.0

Enumeration type for Doctrine - floats only

  Sources   Download

MIT

The Requires

 

The Development Requires