Nessuna descrizione

gabriel 8c5c104e17 Prueba 8 anni fa
Entity 8c5c104e17 Prueba 8 anni fa
EventListener b6b510da9e Iniciando el proyecto de voter. 8 anni fa
Resources b6b510da9e Iniciando el proyecto de voter. 8 anni fa
OwnerVoterBundle.php b6b510da9e Iniciando el proyecto de voter. 8 anni fa
README.md 34bc66fa8f Agregado del README.md 8 anni fa
composer.json b6b510da9e Iniciando el proyecto de voter. 8 anni fa

README.md

OwnerVoterBundle

Installation

composer.json:

"repositories": [
    {
        "type": "vcs",
        "url":  "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/OwnerVoter.git"
    }
],
"require": {
    "ik/owner-voter-bundle": "dev-master"
},

app/AppKernel.php:

public function registerBundles()
{
    $bundles = [
        new OwnerVoterBundle\OwnerVoterBundle(),
    ];
    .
    .
}

app/config/config.yml:

imports:
    - { resource: "@ExtraBundle/Resources/config/services.yml" }

Traits

  • Entity\Traits\OwnerVoterTrait: Agrega el campo owner de tipo string con el nombre de usuario que se utilizará para chequear los permisos con Voter.
use OwnerVoterBundle\Entity\Traits\OwnerVoterTrait;

/**
 * @ORM\Entity
 */
class Workflow
{

    use OwnerVoterTrait;

Luego ejecutar

$ bin/console doctrine:schema:update --force

use Symfony\Component\Validator\Constraints as Assert;

...

    /**
     * @var string $extraData
     *
     * @ORM\Column(type="string", length=128, nullable=false)
     * 
     * @Assert\NotBlank(
     *   message="",
     *   payload={"field"="owner"}
     * )
     */
    private $owner;

La option payload={"field"="owner"}, es requerida, es el nombre del campo en el cual se quiere agregar el mensaje de error de validación.