private function publicPropertyPath(FormInterface $form, $path)
    {
        $pathArray = [$path];

        if (strpos($path, '.') !== false) { // object.child.property
            $pathArray = explode('.', $path);
        }

        if (strpos($path, '[') !== false) { //[array][child][property]
            $path = str_replace(']', null, $path);
            $pathArray = explode('[', $path);
        }

        if (in_array($pathArray[0], ['data', 'children'])) {
            array_shift($pathArray);
        }

        $contextForm = $form;
        foreach ($pathArray as &$propName) {
            //for some reason some inputs are resolved as "inputName.data" or "inputName.children"
            //because the original form property is children[inputName].data
            //this is the case of DEMO AddUserInput form the login field is validated as path children[login].data
            //the following statements remove the trailing ".data"
            if (preg_match('/\.(data|children)$/', $propName)) {
                $propName = preg_replace('/\.(data|children)/', null, $propName);
            }

            $index = null;
            if (preg_match('/(\w+)(\[\d+\])$/', $propName, $matches)) {
                list(, $propName, $index) = $matches;
            }
            if (!$contextForm->has($propName)) {
                foreach ($contextForm->all() as $child) {
                    if ($child->getConfig()->getOption('property_path') === $propName) {
                        $propName = $child->getName();
                    }
                }
            }
            if ($index) {
                $propName = sprintf('%s%s', $propName, $index);
            }
        }
        unset($propName);

        return implode('.', $pathArray);
    }
private function publicPropertyPath(FormInterface $form, $path)
    {
        $pathArray = [$path];

        if (strpos($path, '.') !== false) { // object.child.property
            $pathArray = explode('.', $path);
        }

        if (strpos($path, '[') !== false) { //[array][child][property]
            $path = str_replace(']', null, $path);
            $pathArray = explode('[', $path);
        }

        if (in_array($pathArray[0], ['data', 'children'])) {
            array_shift($pathArray);
        }

        $contextForm = $form;
        foreach ($pathArray as &$propName) {
            //for some reason some inputs are resolved as "inputName.data" or "inputName.children"
            //because the original form property is children[inputName].data
            //this is the case of DEMO AddUserInput form the login field is validated as path children[login].data
            //the following statements remove the trailing ".data"
            if (preg_match('/\.(data|children)$/', $propName)) {
                $propName = preg_replace('/\.(data|children)/', null, $propName);
            }

            $index = null;
            if (preg_match('/(\w+)(\[\d+\])$/', $propName, $matches)) {
                list(, $propName, $index) = $matches;
            }
            if (!$contextForm->has($propName)) {
                foreach ($contextForm->all() as $child) {
                    if ($child->getConfig()->getOption('property_path') === $propName) {
                        $propName = $child->getName();
                    }
                }
            }
            if ($index) {
                $propName = sprintf('%s%s', $propName, $index);
            }
        }
        unset($propName);

        return implode('.', $pathArray);
    }
private function publicPropertyPath ( FormInterface $ form , $ path ) { $ pathArray = [ $ path ] ; if ( strpos ( $ path , '.' ) !== false ) { // object.child.property $ pathArray = explode ( '.' , $ path ) ; } if ( strpos ( $ path , '[' ) !== false ) { //[array][child][property] $ path = str_replace ( ']' , null , $ path ) ; $ pathArray = explode ( '[' , $ path ) ; } if ( in_array ( $ pathArray [ 0 ] , [ 'data' , 'children' ] ) ) { array_shift ( $ pathArray ) ; } $ contextForm = $ form ; foreach ( $ pathArray as & $ propName ) { //for some reason some inputs are resolved as "inputName.data" or "inputName.children" //because the original form property is children[inputName].data //this is the case of DEMO AddUserInput form the login field is validated as path children[login].data //the following statements remove the trailing ".data" if ( preg_match ( '/\.(data|children)$/' , $ propName ) ) { $ propName = preg_replace ( '/\.(data|children)/' , null , $ propName ) ; } $ index = null ; if ( preg_match ( '/(\w+)(\[\d+\])$/' , $ propName , $ matches ) ) { list ( , $ propName , $ index ) = $ matches ; } if ( ! $ contextForm -> has ( $ propName ) ) { foreach ( $ contextForm -> all ( ) as $ child ) { if ( $ child -> getConfig ( ) -> getOption ( 'property_path' ) === $ propName ) { $ propName = $ child -> getName ( ) ; } } } if ( $ index ) { $ propName = sprintf ( '%s%s' , $ propName , $ index ) ; } } unset ( $ propName ) ; return implode ( '.' , $ pathArray ) ; }
Convert internal validation property path to the public one,
required when use `property_path` in the form

@param FormInterface $form
@param string        $path

@return string
Convert internal validation property path to the public one required when use property_path in the form