I'm using Symfony and I would like to do a 3 Levels optgroup what I want is :

Category 1 (Disabled)  

--ChildCategory 1.1  

--ChildCategory 1.2 (Disabled)  

----ChildChildCategory 1.2.1  

Category 2  

But all i got is :

Category 1 (Disabled)  

--ChildCategory 1.1  

ChildCategory 1.2 (Disabled)  

--ChildChildCategory 1.2.1  

Category 2  

My HTML Code : 

```
<select id="event_category" name="event[category]" class="form-control">
<optgroup label="Category 1">
    <option value="8">Category 1.1</option>
</optgroup>
<optgroup label="Category 1.2">
    <option value="7">Category 1.2.1</option>
</optgroup>
    <option value="3">Category 2</option>
</select>

```

I'm creation an array with this code to add it to my formType :

```
$arrayCategories = array();
        foreach ($categories as $category)
        {
            if (count($category->getChildren()) > 0)
            {
                $arrayCategories[$category->getTitle()] = array();

                foreach ($category->getChildren() as $child)
                {
                    if (count($child->getChildren()) > 0)
                    {
                        $arrayCategories[$category->getTitle()][$child->getTitle()] = array();

                        foreach ($child->getChildren() as $child2)
                        {
                            $arrayCategories[$category->getTitle()][$child->getTitle()][$child2->getTitle().' - '. $child2->getLangLabel()] = $child2->getId();
                        }
                    }
                    else
                    {
                        $arrayCategories[$category->getTitle()][$child->getTitle().' - '. $child->getLangLabel()] = $child->getId();
                    }
                }
            }
            else
            {
                $arrayCategories[$category->getTitle().' - '. $category->getLangLabel()] = $category->getId();
            }
        }

```

Thanks for you help !