2017 © Pedro Peláez
 

library doctrine-extensions

Collection of useful types and other minor extensions to the Doctrine DBAL and ORM.

image

graefe/doctrine-extensions

Collection of useful types and other minor extensions to the Doctrine DBAL and ORM.

  • Thursday, May 26, 2016
  • by cgraefe
  • Repository
  • 1 Watchers
  • 0 Stars
  • 115 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Doctrine-Extensions

Build Status, (*1)

This is a collection of useful types and other minor extensions to the Doctrine DBAL and ORM., (*2)

UnixTimeType

UnixTimeType is a custom Doctrine mapping type for time-stamp values represented in unix time, i.e. seconds since Jan 1, 1970., (*3)

// Register custom type during boot-strap.
\Doctrine\DBAL\Types\Type::addType('unixtime', '\Graefe\Doctrine\Type\UnixTimeType');

...

/**
 * @ORM\Column(name="created", type="unixtime", nullable=false)
 */
private $created;

MySqlEnumType

MySqlEnumType is an abstract base class for mapping ENUM types in MySQL., (*4)

// Define type.
class ShopModeType extends \Graefe\Doctrine\Type\MySqlEnumType
{
    protected function getValues() { return array('b2b','b2c'); }
    public function getName() { return 'shopmode'; }
}

...

// Register type during boot-strap.
\Doctrine\DBAL\Types\Type::addType('shopmode', 'ShopModeType');

...

/**
 * @ORM\Column(name="mode", type="shopmode", nullable=false)
 */
private $mode;

RAND()

The Rand class provides the RAND() function to DQL for selecting random rows. (Caveat: Improper use might cause serious performance problems.), (*5)

// Register function.
$em->getConfiguration()->addCustomNumericFunction('RAND', '\\Graefe\\Doctrine\\Functions\\Rand');

...

$qb->select('d')
    ->addSelect('RAND() AS randval')
    ->from('Dummy', 'd')
    ->orderBy('randval')
    ->setMaxResults(1);

The Versions

26/05 2016

dev-master

9999999-dev

Collection of useful types and other minor extensions to the Doctrine DBAL and ORM.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christian Graefe

26/05 2016

v0.3.0

0.3.0.0

Collection of useful types and other minor extensions to the Doctrine DBAL and ORM.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christian Graefe

20/04 2016

v0.2.1

0.2.1.0

Collection of useful types and other minor extensions to the Doctrine DBAL and ORM.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christian Graefe

03/03 2016

v0.2.0

0.2.0.0

Collection of useful types and other minor extensions to the Doctrine DBAL and ORM.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christian Graefe

01/03 2016

v0.1.0

0.1.0.0

Collection of useful types and other minor extensions to the Doctrine DBAL and ORM.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christian Graefe