survos/core-bundle

Traits and Interfaces common to other Survos bundles

Fund package maintenance!
kbond

Installs: 4 125

Dependents: 11

Suggesters: 0

Security: 0

Stars: 2

Watchers: 3

Forks: 0

Open Issues: 0

Type:symfony-bundle

1.5.394 2024-11-21 14:26 UTC

This package is auto-updated.

Last update: 2024-11-21 23:47:19 UTC


README

Symfony Bundle with interfaces, traits, models and services needed by more than one Survos components. For example, Model\Column is used by grid, api-grid and simple-datatables. RouteParametersInterface is used by tree and the griid bundles.

symfony/symfony#20083

composer req survos/core-bundle
<?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()];
}

Now use .rp in twig and ->getRp() in php as part of generating a route

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

Combined with survos/maker-bundle, create a param converter

bin/console survos:make:param-converter Foo

Helper Tasks

echo "SYMFONY_DEPRECATIONS_HELPER=weak" >> .env