---
title: Entry
---

# Entry

<div class="documentation__toc"></div>

## Introduction

The `entry` property defines which entry the form is to use. If no entry is provided the form will create a new one.

You can set the entry by passing an ID or instance to the `build`, `make`, or `render` methods.

```php
<?php namespace Test\ExampleModule\Http\Controller\Admin;

use Test\ExampleModule\Widget\Form\WidgetFormBuilder;
use Anomaly\Streams\Platform\Http\Controller\AdminController;

class WidgetsController extends AdminController
{
    public function edit(WidgetFormBuilder $builder, $id)
    {
        return $builder->render($id);
    }
}
```

You can also set an instantiated entry on the builder and edit it:

```php
<?php namespace Test\ExampleModule\Http\Controller\Admin;

use Test\ExampleModule\Widget\Form\WidgetFormBuilder;
use Anomaly\Streams\Platform\Http\Controller\AdminController;

class WidgetsController extends AdminController
{
    public function edit(WidgetFormBuilder $builder, WidgetRepositoryInterface $widgets, $id)
    {
        if (!$widget = $widgets->find($id)) {
            abort();
        }

        return $builder->render($widget);
    }
}
```

You can also use `setEntry` to set the entry at any time prior to building.

```php
$builder->setEntry($entry);
```

```twig
{{ form('test', 'example').entry(request_segments()|last).render()|raw }}
```
