<p dir="auto">I think there should be a way to access all the entity constraints in Form class so that we can pass those information to client side without manually entering those constraints all over again in form class.</p>
<p dir="auto">For example if we have code like this.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class User implements UserInterface, \Serializable
{
  /**
   * @var string
   *
   * @ORM\Column(name=&quot;first_name&quot;, type=&quot;string&quot;, length=64)
   * @Assert\NotBlank(message=&quot;First name cannot be blank&quot;)
   * @Assert\Length(max=64, maxMessage=&quot;First name cannot more than {{ limit }} characters long&quot;)
   */ 
   private $firstName;
}"><pre class="notranslate"><code class="notranslate">class User implements UserInterface, \Serializable
{
  /**
   * @var string
   *
   * @ORM\Column(name="first_name", type="string", length=64)
   * @Assert\NotBlank(message="First name cannot be blank")
   * @Assert\Length(max=64, maxMessage="First name cannot more than {{ limit }} characters long")
   */ 
   private $firstName;
}
</code></pre></div>
<p dir="auto">I would like to access these constraints with messages in form class so that we pass down these information to twig. Like this</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;input type=&quot;text&quot; required=&quot;required&quot; data-required-msg=&quot;First name cannot be blank&quot; name=&quot;firstname&quot; data-max-length=&quot;64&quot; data-max-length-msg=&quot;First name cannot be more than 64 characters long&quot;&gt;"><pre class="notranslate"><code class="notranslate">&lt;input type="text" required="required" data-required-msg="First name cannot be blank" name="firstname" data-max-length="64" data-max-length-msg="First name cannot be more than 64 characters long"&gt;
</code></pre></div>
<p dir="auto">Here data attribute should be customizable.</p>
<p dir="auto">Currently this cannot be achieved without code duplication in either twig or in form class directly.</p>
<p dir="auto"><strong>Description</strong><br>
My request is about the possibility of adding a paginator component to quickly create pagination for entities without requiring third party bundle. Other framework like Laravel, CakePHP or ZF have their own build in pagination system so, why not Symfony ?</p>
<p dir="auto">I know there is some great community bundle to do that, like <a href="https://github.com/KnpLabs/KnpPaginatorBundle">KnpPaginatorBundle</a> but i think a framework like Symfony should not depend on a third bundle for this kind of feature, even if this bundle is actively maintain.</p>
<p dir="auto">Finally, when i was searching for informations about pagination in Symfony, i was quiet surprised to see there is nothing about that in the official documentation, except some references to EasyAdminBundle which is not really related to the topic. Maybe it could be usefull to add a note about that in the doc ? Even if it's to redirect developers to community bundles. But this should probably be discussed in a new issue on the documentation repository.</p>
<p dir="auto"><strong>Example</strong><br>
Here is a quick example for what i have in mind</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;?php

namespace App\Controller;

use App\Repository\BlogRepository;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Routing\Annotation\Route;

class BlogController extends Controller
{
    /**
     * @Route(&quot;/blog/{page}&quot;, name=&quot;blog_list&quot;, requirements={&quot;page&quot;=&quot;\d+&quot;})
     */
    public function index(int $page = 1, BlogRepository $blogRepository)
    {
        $query = $articleRepository-&gt;findAll();
        $maxResult = 10;

        return $this-&gt;render('blog/index.html.twig', [
            'articles' =&gt; $this-&gt;paginate($query, $page, $maxResult)
        ]);
    }
}"><pre class="notranslate"><span class="pl-ent">&lt;?php</span>

<span class="pl-k">namespace</span> <span class="pl-v">App</span>\<span class="pl-v">Controller</span>;

<span class="pl-k">use</span> <span class="pl-v">App</span>\<span class="pl-v">Repository</span>\<span class="pl-v">BlogRepository</span>;
<span class="pl-k">use</span> <span class="pl-v">Symfony</span>\<span class="pl-v">Bundle</span>\<span class="pl-v">FrameworkBundle</span>\<span class="pl-v">Controller</span>\<span class="pl-v">Controller</span>;
<span class="pl-k">use</span> <span class="pl-v">Symfony</span>\<span class="pl-v">Component</span>\<span class="pl-v">Routing</span>\<span class="pl-v">Annotation</span>\<span class="pl-v">Route</span>;

<span class="pl-k">class</span> <span class="pl-v">BlogController</span> <span class="pl-k">extends</span> <span class="pl-v">Controller</span>
{
    <span class="pl-c">/**</span>
<span class="pl-c">     * @Route("/blog/{page}", name="blog_list", requirements={"page"="\d+"})</span>
<span class="pl-c">     */</span>
    <span class="pl-k">public</span> <span class="pl-k">function</span> <span class="pl-en">index</span>(<span class="pl-smi">int</span> <span class="pl-s1"><span class="pl-c1">$</span>page</span> = <span class="pl-c1">1</span>, <span class="pl-smi"><span class="pl-smi">BlogRepository</span></span> <span class="pl-s1"><span class="pl-c1">$</span>blogRepository</span>)
    {
        <span class="pl-s1"><span class="pl-c1">$</span>query</span> = <span class="pl-s1"><span class="pl-c1">$</span>articleRepository</span>-&gt;<span class="pl-en">findAll</span>();
        <span class="pl-s1"><span class="pl-c1">$</span>maxResult</span> = <span class="pl-c1">10</span>;

        <span class="pl-k">return</span> <span class="pl-s1"><span class="pl-c1">$</span><span class="pl-smi">this</span></span>-&gt;<span class="pl-en">render</span>(<span class="pl-s">'blog/index.html.twig'</span>, [
            <span class="pl-s">'articles'</span> =&gt; <span class="pl-s1"><span class="pl-c1">$</span><span class="pl-smi">this</span></span>-&gt;<span class="pl-en">paginate</span>(<span class="pl-s1"><span class="pl-c1">$</span>query</span>, <span class="pl-s1"><span class="pl-c1">$</span>page</span>, <span class="pl-s1"><span class="pl-c1">$</span>maxResult</span>)
        ]);
    }
}</pre></div>