graefe/doctrine-extensions
Composer 安装命令:
composer require graefe/doctrine-extensions
包简介
Collection of useful types and other minor extensions to the Doctrine DBAL and ORM.
README 文档
README
This is a collection of useful types and other minor extensions to the Doctrine DBAL and ORM.
UnixTimeType
UnixTimeType is a custom Doctrine mapping type for time-stamp values represented in unix time, i.e. seconds since Jan 1, 1970.
// 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.
// 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.)
// Register function. $em->getConfiguration()->addCustomNumericFunction('RAND', '\\Graefe\\Doctrine\\Functions\\Rand'); ... $qb->select('d') ->addSelect('RAND() AS randval') ->from('Dummy', 'd') ->orderBy('randval') ->setMaxResults(1);
统计信息
- 总下载量: 126
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-03-01