survos/core-bundle

与其他 Survos 组件共用的特性和接口

资助包维护!
kbond

安装量: 3,797

依赖项: 11

建议者: 0

安全性: 0

星标: 2

关注者: 3

分支: 0

开放性问题: 0

类型:symfony-bundle

1.5.340 2024-07-24 15:21 UTC

This package is auto-updated.

Last update: 2024-09-24 13:45:05 UTC


README

Symfony Bundle 包含多个 Survos 组件所需的接口、特性、模型和服务。例如,Model\Column 被网格、api-grid 和 simple-datatables 使用。RouteParametersInterface 被树和网格包使用。

composer config repositories.survos_core '{"type": "path", "url": "/home/tac/survos/bundles/core-bundle"}'
composer req survos/core-bundle:*@dev
<?php
// src/Entity/Foo.php
namespace App\Entity;

use Survos\CoreBundle\Entity\RouteParametersInterface;
use Survos\CoreBundle\Entity\RouteParametersTrait;

class Foo implements RouteParametersInterface
{
use RouteParametersTrait;

public function getUniqueParams(): array { 
    return ['fooId' => $this->getFooCode()];
}

现在在 twig 中使用 .rp,在 php 中使用 ->getRp() 作为生成路由的一部分

<a href="{{ path('foo_show', foo.rp) }}">Show</a>

与 survos/maker-bundle 结合,创建一个参数转换器

bin/console survos:make:param-converter Foo

辅助任务

echo "SYMFONY_DEPRECATIONS_HELPER=weak" >> .env