PHP code example of fluoresce / validate-embedded

1. Go to this page and download the library: Download fluoresce/validate-embedded library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fluoresce / validate-embedded example snippets




use Fluoresce\ValidateEmbedded\Constraints as Fluoresce;

class Author
{
    /**
     * @var Book[]
     * @Fluoresce\Validate(groups={"group1"});
     */
    private $books;
}



use Symfony\Component\Validator\Constraints as Assert;

class Book
{
    /**
     * @var string
     * @Assert\NotBlank()
     */
    private $title;
}



use Fluoresce\ValidateEmbedded\Constraints as Fluoresce;

class Author
{
    /**
     * @var Book[]
     * @Fluoresce\Validate(embeddedGroups={"bookgroup1"});
     */
    private $books;
}



use Symfony\Component\Validator\Constraints as Assert;

class Book
{
    /**
     * @var string
     * @Assert\NotBlank(groups={"bookgroup1"})
     */
    private $title;
}



use Fluoresce\ValidateEmbedded\Constraints as Fluoresce;

class Author
{
    /**
     * @var Book[]
     * @Fluoresce\Validate(groups={"group1"}, embeddedGroups={"bookgroup1"});
     */
    private $books;
}



use Symfony\Component\Validator\Constraints as Assert;

class Book
{
    /**
     * @var string
     * @Assert\NotBlank(groups={"bookgroup1"})
     */
    private $title;
}