Zend certified PHP/Magento developer

Attribute value not showing properly in admin form

I have created a custom ‘Forme’ product attribute select type based on option value

class FormeOptions extends AbstractSource
{
    /**
     * Get all options
     *
     * @return array
     */
    public function getAllOptions()
    {
        if (null === $this->_options) {
            $this->_options=[
                ['label' => __('-- Non renseigné --'), 'value' => 0],
                ['label' => __('Coeur 65 à 75g'), 'value' => 1],
                ['label' => __('Grand Galet 75 à 79g'), 'value' => 2],
                ['label' => __('Galet 50g environ'), 'value' => 3],
                ['label' => __('Boule 45 à 55g environ'), 'value' => 4],
                ['label' => __('Boule de 100g environ'), 'value' => 5],
                ['label' => __('Boule de 100g environ'), 'value' => 6],
            ];
        }
        return $this->_options;
    }
}

Created like below

           $eavSetup->addAttribute(
                Product::ENTITY,
                $attributeCode,
                [
                    'type' => 'varchar',
                    'label' => 'Forme',
                    'input' => 'select',
                    'required' => false,
                    'source' => 'CpyImportModelConfigFormeOptions',
                    'global' => ScopedAttributeInterface::SCOPE_GLOBAL,
                    'searchable' => false,
                    'filterable' => false,
                    'comparable' => false,
                    'used_in_product_listing' => true,
                    'visible_on_front' => true,
                    'is_used_in_grid' => true,
                    'sort_order' => 52,
                ]
            );

In my catalog_product_entity_varchar

The attribute value is properly registered (stored during a custom import)

value_id,attribute_id,store_id,entity_id,value
108417,173,0,5487,Coeur 65 à 75g

But on the product form admin page…it’s still shows the field first value and if i go to see in the listing grid the value is empty.

grid

listing

Any idea on what I am missing there ?

EDIT : If i’m submitting from the product admin page, the value is saved and shown properly.

The problem seems to occured only when I try to do this on my import :

        try{
            $productChild = $this->productRepository->getById($childProductId);
            switch ($attribute['name']){
                case 'forme':
                    $value = $attribute['value'];
                    $productChild->setForme($value);
                    var_dump("Written forme :".$productChild->getForme());
                    break;
                case 'poids':
                    $value = $attribute['value'];
                    $productChild->setPoids($value);
                    var_dump("Written Poids :".$productChild->getPoids());
                    break;
                default :
                    break;
            }
            $this->productRepository->save($productChild);