bukashk0zzz/timestamptype-bundle

一个简单的Symfony扩展包,用于添加时间戳表单字段类型。

安装次数: 41,596

依赖者: 0

推荐者: 0

安全性: 0

星星: 1

关注者: 3

分支: 0

类型:symfony-bundle

v2.4.2 2024-04-04 14:42 UTC

This package is auto-updated.

Last update: 2024-09-04 15:33:50 UTC


README

Build Status Code Coverage Scrutinizer Code Quality License Latest Stable Version Total Downloads

关于

一个简单的Symfony扩展包,用于添加时间戳表单字段类型。

安装

将以下内容添加到您的composer.json文件中

"require": {
	"bukashk0zzz/timestamptype-bundle": "^2.0",
}

将此扩展包添加到app/AppKernel.php

$bundles = array(
	// ... other bundles
	new Bukashk0zzz\TimestampTypeBundle\Bukashk0zzzTimestampTypeBundle(),
);

配置

无需配置。

使用方法

在FormType内部

class AccountProfileType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('nameFirst', TextType::class, ['label' => 'First Name'])
            ->add('nameLast', TextType::class, ['label' => 'Last Name'])
            ->add('startWorking', TimestampType::class, [
                'label' => 'Start working from',
                'required' => false,
            ])
        ;
    }
}

版权 / 许可证

查看LICENSE