-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Updated form/* articles to Symfony 4 #8755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,7 +156,7 @@ In your controller, you'll create a new form from the ``TaskType``:: | |
|
||
class TaskController extends Controller | ||
{ | ||
public function newAction(Request $request) | ||
public function new(Request $request) | ||
{ | ||
$task = new Task(); | ||
|
||
|
@@ -215,7 +215,7 @@ zero tags when first created). | |
|
||
.. code-block:: html+php | ||
|
||
<!-- src/Resources/views/Task/new.html.php --> | ||
<!-- templates/task/new.html.php --> | ||
|
||
<!-- ... --> | ||
|
||
|
@@ -399,7 +399,7 @@ one example: | |
// Replace '__name__label__' in the prototype's HTML to | ||
// instead be a number based on how many items we have | ||
// newForm = newForm.replace(/__name__label__/g, index); | ||
|
||
// Replace '__name__' in the prototype's HTML to | ||
// instead be a number based on how many items we have | ||
newForm = newForm.replace(/__name__/g, index); | ||
|
@@ -510,7 +510,7 @@ you will learn about next!). | |
|
||
.. code-block:: yaml | ||
|
||
# src/Resources/config/doctrine/Task.orm.yml | ||
# src/Resources/config/doctrine/Task.orm.yaml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's sad. Reverted. |
||
App\Entity\Task: | ||
type: entity | ||
# ... | ||
|
@@ -681,7 +681,7 @@ the relationship between the removed ``Tag`` and ``Task`` object. | |
you'll need to do more work for the removed tags to persist correctly. | ||
|
||
In this case, you can modify the controller to remove the relationship | ||
on the removed tag. This assumes that you have some ``editAction()`` which | ||
on the removed tag. This assumes that you have some ``edit()`` action which | ||
is handling the "update" of your Task:: | ||
|
||
// src/Controller/TaskController.php | ||
|
@@ -690,7 +690,7 @@ the relationship between the removed ``Tag`` and ``Task`` object. | |
use Doctrine\Common\Collections\ArrayCollection; | ||
|
||
// ... | ||
public function editAction($id, Request $request) | ||
public function edit($id, Request $request) | ||
{ | ||
$em = $this->getDoctrine()->getManager(); | ||
$task = $em->getRepository(Task::class)->find($id); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,7 @@ from inside a controller:: | |
|
||
class DefaultController extends Controller | ||
{ | ||
public function newAction(Request $request) | ||
public function new(Request $request) | ||
{ | ||
// create a task and give it some dummy data for this example | ||
$task = new Task(); | ||
|
@@ -221,7 +221,7 @@ your controller:: | |
// ... | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
public function newAction(Request $request) | ||
public function new(Request $request) | ||
{ | ||
// just setup a fresh $task object (remove the dummy data) | ||
$task = new Task(); | ||
|
@@ -338,7 +338,7 @@ object. | |
|
||
.. code-block:: yaml | ||
|
||
# src/Resources/config/validation.yml | ||
# src/Resources/config/validation.yaml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
App\Entity\Task: | ||
properties: | ||
task: | ||
|
@@ -516,7 +516,7 @@ the type of your field and set it up for you. In this example, Symfony can | |
guess from the validation rules that both the ``task`` field is a normal | ||
``TextType`` field and the ``dueDate`` field is a ``DateType`` field:: | ||
|
||
public function newAction() | ||
public function new() | ||
{ | ||
$task = new Task(); | ||
|
||
|
@@ -615,7 +615,7 @@ be used to quickly build a form object in the controller:: | |
// src/Controller/DefaultController.php | ||
use App\Form\TaskType; | ||
|
||
public function newAction() | ||
public function new() | ||
{ | ||
$task = ...; | ||
$form = $this->createForm(TaskType::class, $task); | ||
|
@@ -708,4 +708,3 @@ Learn more | |
|
||
.. _`Symfony Form component`: https://github.com/symfony/form | ||
.. _`DateTime`: http://php.net/manual/en/class.datetime.php | ||
.. _`2.8 UPGRADE Log`: https://github.com/symfony/symfony/blob/2.8/UPGRADE-2.8.md#form |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be
src/Resources/...
for PHP templating engine, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure ... but I've reverted my changes. In any case, we'll remove all PHP template examples very soon.