Skip to content

Commit cd9b93e

Browse files
committed
Add docs section about referencing the service from AbstractController
Refs #49
1 parent 8d52ef8 commit cd9b93e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

docs/source/index.html.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ otherwise we render a template with the table provided as a parameter.
105105

106106
<aside class="notice">To keep your controller thin you should <a href="#datatable-types">make reusable DataTable types under the DataTable namespace of your app/bundle</a>.</aside>
107107

108+
## Controller setup
109+
110+
When using <code>DataTablesTrait</code> it is assumed that the <code>DataTableFactory</code> trait is available
111+
in the controller's <code>$container</code>. When using Symfony's legacy <code>Controller</code> base class this
112+
is true. If using <code>AbstractController</code> instead, which is currently recommended practice, ensure
113+
you subscribe to the <code>DataTableFactory</code> service yourself. Alternatively you can bypass the convenience
114+
trait and inject the service via regular constructor injection.
115+
108116
## Frontend code
109117

110118
```html

0 commit comments

Comments
 (0)