|
7 | 7 | use Illuminate\Support\Facades\Blade; |
8 | 8 | use Barryvdh\Form\Extension\SessionExtension; |
9 | 9 | use Illuminate\View\View; |
| 10 | +use Symfony\Component\Form\Extension\Core\CoreExtension; |
10 | 11 | use Symfony\Component\Form\Form; |
11 | 12 | use Symfony\Component\Form\FormFactory; |
| 13 | +use Symfony\Component\Form\FormFactoryBuilder; |
12 | 14 | use Symfony\Component\Form\FormFactoryInterface; |
13 | 15 | use Symfony\Component\Form\FormRendererInterface; |
14 | 16 | use Symfony\Component\Form\Forms; |
| 17 | +use Symfony\Component\PropertyAccess\PropertyAccess; |
15 | 18 | use Barryvdh\Form\Extension\EloquentExtension; |
16 | 19 | use Symfony\Bridge\Twig\Form\TwigRendererEngine; |
17 | 20 | use Symfony\Bridge\Twig\Form\TwigRendererEngineInterface; |
@@ -62,7 +65,7 @@ public function boot() |
62 | 65 | } |
63 | 66 | return app('translator')->get($id, $replace, $locale); |
64 | 67 | })); |
65 | | - |
| 68 | + |
66 | 69 | // csrf_token needs to be replaced for Laravel |
67 | 70 | $twig->addFunction(new \Twig\TwigFunction('csrf_token', 'csrf_token')); |
68 | 71 |
|
@@ -117,7 +120,14 @@ public function register() |
117 | 120 | }); |
118 | 121 |
|
119 | 122 | $this->app->singleton(FormFactory::class, function ($app) { |
120 | | - return Forms::createFormFactoryBuilder() |
| 123 | + |
| 124 | + // Disable Invalid Property access because or how Eloquent works |
| 125 | + $propertyAccess = PropertyAccess::createPropertyAccessorBuilder() |
| 126 | + ->disableExceptionOnInvalidPropertyPath() |
| 127 | + ->getPropertyAccessor(); |
| 128 | + |
| 129 | + return (new FormFactoryBuilder(false)) |
| 130 | + ->addExtension(new CoreExtension($propertyAccess)) |
121 | 131 | ->addExtensions($app['form.extensions']) |
122 | 132 | ->addTypeExtensions($app['form.type.extensions']) |
123 | 133 | ->addTypeGuessers($app['form.type.guessers']) |
|
0 commit comments