PropertyPathBuilder example

/** * @author Bernhard Schussek <bschussek@gmail.com> */
class PropertyPathBuilderTest extends TestCase
{
    private const PREFIX = 'old1[old2].old3[old4][old5].old6';

    private PropertyPathBuilder $builder;

    protected function setUp(): void
    {
        $this->builder = new PropertyPathBuilder(new PropertyPath(self::PREFIX));
    }

    public function testCreateEmpty()
    {
        $builder = new PropertyPathBuilder();

        $this->assertNull($builder->getPropertyPath());
    }

    public function testCreateCopyPath()
    {
        
$it->seek($foundAtIndex);
        }

        return $target;
    }

    /** * Reconstructs a property path from a violation path and a form tree. */
    private function reconstructPath(ViolationPath $violationPath, FormInterface $origin): ?RelativePath
    {
        $propertyPathBuilder = new PropertyPathBuilder($violationPath);
        $it = $violationPath->getIterator();
        $scope = $origin;

        // Remember the current index in the builder         $i = 0;

        // Expand elements that map to a form (like "children[address]")         for ($it->rewind()$it->valid() && $it->mapsForm()$it->next()) {
            if (!$scope->has($it->current())) {
                // Scope relates to a form that does not exist                 // Bail out
Home | Imprint | This part of the site doesn't use cookies.