src/Bridge/Doctrine/Common/PropertyHelperTrait.php
protected function splitPropertyParts(string $property/*, string $resourceClass*/): array
    {
        $resourceClass = null;
        $parts = explode('.', $property);

        if (\func_num_args() > 1) {
            $resourceClass = func_get_arg(1);
        } elseif (__CLASS__ !== \get_class($this)) {
            $r = new \ReflectionMethod($this, __FUNCTION__);
            if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
                @trigger_error(sprintf('Method %s() will have a second `$resourceClass` argument in version API Platform 3.0. Not defining it is deprecated since API Platform 2.1.', __FUNCTION__), E_USER_DEPRECATED);
            }
        }

        if (null === $resourceClass) {
            return [
                'associations' => \array_slice($parts, 0, -1),
                'field' => end($parts),
            ];
        }

        $metadata = $this->getClassMetadata($resourceClass);
        $slice = 0;

        foreach ($parts as $part) {
            if ($metadata->hasAssociation($part)) {
                $metadata = $this->getClassMetadata($metadata->getAssociationTargetClass($part));
                ++$slice;
            }
        }

        if (\count($parts) === $slice) {
            --$slice;
        }

        return [
            'associations' => \array_slice($parts, 0, $slice),
            'field' => implode('.', \array_slice($parts, $slice)),
        ];
    }
protected function splitPropertyParts(string $property/*, string $resourceClass*/): array
    {
        $resourceClass = null;
        $parts = explode('.', $property);

        if (\func_num_args() > 1) {
            $resourceClass = func_get_arg(1);
        } elseif (__CLASS__ !== \get_class($this)) {
            $r = new \ReflectionMethod($this, __FUNCTION__);
            if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
                @trigger_error(sprintf('Method %s() will have a second `$resourceClass` argument in version API Platform 3.0. Not defining it is deprecated since API Platform 2.1.', __FUNCTION__), E_USER_DEPRECATED);
            }
        }

        if (null === $resourceClass) {
            return [
                'associations' => \array_slice($parts, 0, -1),
                'field' => end($parts),
            ];
        }

        $metadata = $this->getClassMetadata($resourceClass);
        $slice = 0;

        foreach ($parts as $part) {
            if ($metadata->hasAssociation($part)) {
                $metadata = $this->getClassMetadata($metadata->getAssociationTargetClass($part));
                ++$slice;
            }
        }

        if (\count($parts) === $slice) {
            --$slice;
        }

        return [
            'associations' => \array_slice($parts, 0, $slice),
            'field' => implode('.', \array_slice($parts, $slice)),
        ];
    }
protected function splitPropertyParts ( string $ property /*, string $resourceClass*/ ) : array { $ resourceClass = null ; $ parts = explode ( '.' , $ property ) ; if ( \ func_num_args ( ) > 1 ) { $ resourceClass = func_get_arg ( 1 ) ; } elseif ( __CLASS__ !== \ get_class ( $ this ) ) { $ r = new \ ReflectionMethod ( $ this , __FUNCTION__ ) ; if ( __CLASS__ !== $ r -> getDeclaringClass ( ) -> getName ( ) ) { @ trigger_error ( sprintf ( 'Method %s() will have a second `$resourceClass` argument in version API Platform 3.0. Not defining it is deprecated since API Platform 2.1.' , __FUNCTION__ ) , E_USER_DEPRECATED ) ; } } if ( null === $ resourceClass ) { return [ 'associations' => \ array_slice ( $ parts , 0 , - 1 ) , 'field' => end ( $ parts ) , ] ; } $ metadata = $ this -> getClassMetadata ( $ resourceClass ) ; $ slice = 0 ; foreach ( $ parts as $ part ) { if ( $ metadata -> hasAssociation ( $ part ) ) { $ metadata = $ this -> getClassMetadata ( $ metadata -> getAssociationTargetClass ( $ part ) ) ; ++ $ slice ; } } if ( \ count ( $ parts ) === $ slice ) { -- $ slice ; } return [ 'associations' => \ array_slice ( $ parts , 0 , $ slice ) , 'field' => implode ( '.' , \ array_slice ( $ parts , $ slice ) ) , ] ; }
Splits the given property into parts.

Returns an array with the following keys:
- associations: array of associations according to nesting order
- field: string holding the actual field (leaf node)
Splits the given property into parts .