src/Admin/AdminHelper.php
public function getElementAccessPath($elementId, $entity)
    {
        $propertyAccessor = $this->pool->getPropertyAccessor();

        $idWithoutIdentifier = preg_replace('/^[^_]*_/', '', $elementId);
        $initialPath = preg_replace('#(_(\d+)_)#', '[$2]_', $idWithoutIdentifier);

        $parts = explode('_', $initialPath);
        $totalPath = '';
        $currentPath = '';

        foreach ($parts as $part) {
            $currentPath .= empty($currentPath) ? $part : '_'.$part;
            $separator = empty($totalPath) ? '' : '.';

            if ($propertyAccessor->isReadable($entity, $totalPath.$separator.$currentPath)) {
                $totalPath .= $separator.$currentPath;
                $currentPath = '';
            }
        }

        if (!empty($currentPath)) {
            throw new \Exception(
                sprintf('Could not get element id from %s Failing part: %s', $elementId, $currentPath)
            );
        }

        return $totalPath;
    }
public function getElementAccessPath($elementId, $entity)
    {
        $propertyAccessor = $this->pool->getPropertyAccessor();

        $idWithoutIdentifier = preg_replace('/^[^_]*_/', '', $elementId);
        $initialPath = preg_replace('#(_(\d+)_)#', '[$2]_', $idWithoutIdentifier);

        $parts = explode('_', $initialPath);
        $totalPath = '';
        $currentPath = '';

        foreach ($parts as $part) {
            $currentPath .= empty($currentPath) ? $part : '_'.$part;
            $separator = empty($totalPath) ? '' : '.';

            if ($propertyAccessor->isReadable($entity, $totalPath.$separator.$currentPath)) {
                $totalPath .= $separator.$currentPath;
                $currentPath = '';
            }
        }

        if (!empty($currentPath)) {
            throw new \Exception(
                sprintf('Could not get element id from %s Failing part: %s', $elementId, $currentPath)
            );
        }

        return $totalPath;
    }
public function getElementAccessPath ( $ elementId , $ entity ) { $ propertyAccessor = $ this -> pool -> getPropertyAccessor ( ) ; $ idWithoutIdentifier = preg_replace ( '/^[^_]*_/' , '' , $ elementId ) ; $ initialPath = preg_replace ( '#(_(\d+)_)#' , '[$2]_' , $ idWithoutIdentifier ) ; $ parts = explode ( '_' , $ initialPath ) ; $ totalPath = '' ; $ currentPath = '' ; foreach ( $ parts as $ part ) { $ currentPath .= empty ( $ currentPath ) ? $ part : '_' . $ part ; $ separator = empty ( $ totalPath ) ? '' : '.' ; if ( $ propertyAccessor -> isReadable ( $ entity , $ totalPath . $ separator . $ currentPath ) ) { $ totalPath .= $ separator . $ currentPath ; $ currentPath = '' ; } } if ( ! empty ( $ currentPath ) ) { throw new \ Exception ( sprintf ( 'Could not get element id from %s Failing part: %s' , $ elementId , $ currentPath ) ) ; } return $ totalPath ; }
Get access path to element which works with PropertyAccessor.

@param string $elementId expects string in format used in form id field.
(uniqueIdentifier_model_sub_model or uniqueIdentifier_model_1_sub_model etc.)
@param mixed  $entity

@throws \Exception

@return string
Get access path to element which works with PropertyAccessor .