Skip to content
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

some defaults Controller actions have wrong params #27

Closed
pesseyjulien opened this issue Dec 13, 2016 · 1 comment
Closed

some defaults Controller actions have wrong params #27

pesseyjulien opened this issue Dec 13, 2016 · 1 comment

Comments

@pesseyjulien
Copy link

pesseyjulien commented Dec 13, 2016

Hi,

It seems that the bundles generates some errors. For example, the following action cannot work :

 /**
     * Finds and displays a Liendefinition entity.
     *
     * @Route("/{id}", name="liendefinition_show")
     * @Method("GET")
     */
    public function showAction(Liendefinition $liendefinition)
    {
        $deleteForm = $this->createDeleteForm($liendefinition);
        return $this->render('liendefinition/show.html.twig', array(
            'liendefinition' => $liendefinition,
            'delete_form' => $deleteForm->createView(),
        ));
    }

The route is define to receive an 'id', but the action function expect an Object, which is not possible.

Instead, it should be something like this :

 /**
     * Finds and displays a Liendefinition entity.
     *
     * @Route("/{id}", name="liendefinition_show")
     * @Method("GET")
     */
    public function showAction($id)
    {
        $em = $this->getDoctrine()->getManager();
        $Liendefinition = $em->getRepository('Liendefinition')->find($id);

        $deleteForm = $this->createDeleteForm($liendefinition);
        return $this->render('liendefinition/show.html.twig', array(
            'liendefinition' => $liendefinition,
            'delete_form' => $deleteForm->createView(),
        ));
    }

Is it possible to fix this ?

Also, the following are more enhancements considerations than bugs, but it would be cool if we could choose where to put the show/edit/delete column. For now, it's a the end of the table, but with entities with a lot of fields, you need to scroll quit a lot to access it.
It would also be cool if we could choose where to send the views, for example inside a bundle.

Thanks,
Julien

@petkopara
Copy link
Owner

Hi @pesseyjulien ,
Thank you for the feedback.

The show code is working fine, if you have SensioFrameworkExtraBundle installed.
Because I am using the @ParamConverter feature. For now the SensioFrameworkExtraBundle is coming with the default installation of Symfony, so shouldn't be a problem. Eventually maybe is a good idea to remove this dependency.

About the columns on show edit and delete - Opened new feature issue #28.
This enhancement is questionable because I think I will run from the original idea of the crud generator(Generate and edit after that). On the other side there is a lot of admin generators that depends on configurations and they are more complex for use.
But as long as these options can be passed through the console and keep the bundle simple to use, I can implement it.

There is already option to save the views inside the bundle --bundle-views.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants