Skip to content
This repository has been archived by the owner on Jan 6, 2020. It is now read-only.

#435 Fixed actions and views #436

Closed
wants to merge 5 commits into from
Closed

#435 Fixed actions and views #436

wants to merge 5 commits into from

Conversation

jkbmaj
Copy link
Contributor

@jkbmaj jkbmaj commented Dec 1, 2015

After resolve action problems, there was problems in views, crud generete for example:

In client/index.html.twig:

<td>{% if entity.isIndividual %}Yes{% else %}No{% endif %}</td>

insted:

<td>{% if client.isIndividual %}Yes{% else %}No{% endif %}</td>

It was fixed too in commit.

@@ -17,7 +17,7 @@
{
{% block method_body %}
$deleteForm = $this->createDeleteForm(${{ entity_singularized }});
$editForm = $this->createForm(new {{ entity_class }}Type(), ${{ entity_singularized }});
$editForm = $this->createForm({{ entity_class }}Type::class, ${{ entity_singularized }});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this does not work in PHP versions before 5.5. To be on the safe side you should probably rather use the FCQN instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for FQN

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a check if php > 5.3 is installed or something like this or an option in the commands?

@@ -43,7 +43,7 @@ public function configure()
inside bundles. Provide the bundle name as the first argument and the command
name as the second argument:

<info>php app/console generate:command AppBundle blog:publish-posts</info>
<info>php bin/console generate:command AppBundle blog:publish-posts</info>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the app/ to bin/ changes must be reverted as we support both 2.x and 3.x dir structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@khalid-s
Copy link

hi, just gave a try for this solution, and works great.

But when generating a crud for a bundle living in a vendor name, there is a \ missing between the vendor name and the bundle name for new and edit action. not sure that am clear. e.g

For a bundle CompanyBundle in the folder /src/IKNSA/CompanyBundle/Controller/CompanyController.php

public function newAction(Request $request)
    {
        $company = new Company();
        $form = $this->createForm('\IKNSACompanyBundle\Form\CompanyType', $company);
        $form->handleRequest($request);

There is a backslash missing between IKNSA and CompanyBundle

@@ -17,7 +17,7 @@
{
{% block method_body %}
$deleteForm = $this->createDeleteForm(${{ entity_singularized }});
$editForm = $this->createForm(new {{ entity_class }}Type(), ${{ entity_singularized }});
$editForm = $this->createForm('\{{ bundle }}\Form\{{ entity_class }}Type', ${{ entity_singularized }});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The leading \ is not needed, same below.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, bundle references the bundle name, not the bundle namespace.

@jkbmaj
Copy link
Contributor Author

jkbmaj commented Dec 18, 2015

It should work fine.

@khalid-s
Copy link

Tested again and it works fine

@fabpot
Copy link
Member

fabpot commented Dec 20, 2015

Thank you @jpyzio.

@fabpot fabpot closed this in 525e078 Dec 20, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
5 participants