|
5 年之前 | |
---|---|---|
.gitlab | 6 年之前 | |
Command | 7 年之前 | |
Entity | 7 年之前 | |
EventListener | 6 年之前 | |
Resources | 6 年之前 | |
Validator | 8 年之前 | |
keys | 7 年之前 | |
.drone.yml | 7 年之前 | |
.gitlab-ci.yml | 5 年之前 | |
ExtraDataBundle.php | 8 年之前 | |
README.md | 8 年之前 | |
composer.json | 7 年之前 | |
cosa.txt | 6 年之前 |
composer.json:
"repositories": [
{
"type": "vcs",
"url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/ExtraDataBundle.git"
}
],
"require": {
"ik/extra-data-bundle": "dev-master"
},
app/AppKernel.php:
public function registerBundles()
{
$bundles = [
new ExtraBundle\ExtraBundle(),
];
.
.
}
app/config/config.yml:
imports:
- { resource: "@ExtraBundle/Resources/config/services.yml" }
use ExtraDataBundle\Entity\Traits\ExtraDataTrait;
/**
* @ORM\Entity
*/
class ONU
{
use ExtraDataTrait;
Luego ejecutar
$ bin/console doctrine:schema:update --force
use Symfony\Component\Validator\Constraints as Assert;
...
/**
* @var string $extraData
*
* @ORM\Column(type="text", nullable=true)
*
* @Assert\Callback(
* callback={"ExtraDataBundle\Validator\JSONValidator", "validate"},
* payload={"field"="extraData"}
* )
*/
private $extraData;
La option payload={"field"="extraData"}, es requerida, es el nombre del campo en el cual se quiere agregar el mensaje de error de validación.