2lenet / EasyAdminPlusBundle

EasyAdminPlusBundle is a Symfony 4 wrapper for the amazing EasyCorp/EasyAdminBundle
MIT License
17 stars 13 forks source link

Nested Set Tree : No filterview on it ? #7

Closed netproject0 closed 6 years ago

netproject0 commented 6 years ago

@sebheitzmann From https://github.com/EasyCorp/EasyAdminBundle/issues/2269 i continue here :

Hi, Dummy question :D => To install your Extension, is it :

1 / "composer require lle/easyadmin-plus-bundle" => From the doc on https://github.com/2lenet/EasyAdminPlusBundle With this i've an console error =>

[InvalidArgumentException] Could not find a matching version of package lle/easyadmin-plus-bundle. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (stable).

Or

2 "composer require 2lenet/easyadmin-plus-bundle" => From the firstline on https://packagist.org/packages/2lenet/easyadmin-plus-bundle ? With this, i can install Extension, i follow your guidelines and when i load my administration i've this error :

Uncaught PHP Exception Twig_Error_Loader: "Unable to find template "LleEasyAdminPlusBundle:form:widget.html.twig" (looked into: /Applications/MAMP/htdocs/Test/Symfony/templates, /Applications/MAMP/htdocs/Test/Symfony/templates, /Applications/MAMP/htdocs/Test/Symfony/vendor/symfony/twig-bridge/Resources/views/Form)." at /Applications/MAMP/htdocs/Test/Symfony/vendor/easycorp/easyadmin-bundle/src/Resources/views/default/includes/_delete_form.html.twig line 2

What i've miss ?

---------EDIT ------------- 1 hour later : I've found a dirty way to resolve my pb :

/Symfony/vendor/2lenet/easyadmin-plus-bundle/src/DependencyInjection/LleEasyAdminPlusExtension.php L26

definitly a bad practice, i know... There is other way ?

Now, I display a nestedSets tree but i feel Symfony/vendor/2lenet/easyadmin-plus-bundle/src/Resources/views/FilterType/treeFilter.html.twig is no apply on it (cf screenshoot) : My items are not sorted.

capture d ecran 2018-07-21 a 19 00 20

After few tests, i've found that i never enter in the "if" :

if (isset($entity['filter'])) => Symfony/vendor/2lenet/easyadmin-plus-bundle/src/Controller/AdminController.php L207

Is it a track ?

FYI : => my /Symfony/config/packages/easy_admin.yaml

Service: class: App\Entity\OeuvrechCategorization tree: true disabled_actions: [] list: title: 'Catégorisation des Oeuvres' help: 'de l'aide ?' max_results: 500

=> my packages:

Sf 4.1.1 Easyadmin : 1.17.13 2lenet/easyadmin-plus-bundle : 1.0.8.3

Thank for you support.

Best.

netproject0 commented 6 years ago

Bonsoir @emilieD68 , En l'absence de réponse de @sebheitzmann As tu une idée sur le problème que je rencontre ?

Merci à toi.

sebheitzmann commented 6 years ago

Désolé, j'étais en congé semaine derniere. Sorry.

For the second point, you need the templating component. Do you have it installed ? I will check the dependencies.

For the filter i will try it on my project to check the compatibility.

sebheitzmann commented 6 years ago

The templating is in the dependency. Could you please send me your composer.json ?

sebheitzmann commented 6 years ago

Now, I display a nestedSets tree but i feel Symfony/vendor/2lenet/easyadmin-plus-bundle/src/Resources/views/FilterType/treeFilter.html.twig is no apply on it (cf screenshoot) : My items are not sorted.

The tree filter is a filter for another easyadmin entity to display a nested dropdown. please have a look on https://github.com/2lenet/EasyAdminPlusBundle/blob/master/doc/chapter-6.md

You could be able to combine tree and filter on the same entities but definitly not filter an entity by itself.

The items are sorted by the order defined in the nestedset. For the future we will certainly add some UI for reordering in the screen.

netproject0 commented 6 years ago

@sebheitzmann : Thank for your feedback. J'espère que les vacances furent bonnes :) since my last post, i've done a fresh install of Sf4. The problem is always display :

Unable to find template "LleEasyAdminPlusBundle:form:widget.html.twig" (looked into: /Applications/MAMP/htdocs/smArt/Gallery/templates, /Applications/MAMP/htdocs/smArt/Gallery/vendor/2lenet/easyadmin-plus-bundle/src/Resources/views/form, /Applications/MAMP/htdocs/smArt/Gallery/templates, /Applications/MAMP/htdocs/smArt/Gallery/vendor/symfony/twig-bridge/Resources/views/Form).

This is my composer.json (i've got template component)

{
    "type": "project",
    "license": "proprietary",
    "require": {
        "php": "^7.1.3",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "2lenet/easyadmin-plus-bundle": "^1.0.8.19",
        "easycorp/easyadmin-bundle": "1.17.13",
        "sensio/framework-extra-bundle": "^5.2",
        "stof/doctrine-extensions-bundle": "^1.3",
        "symfony/console": "^4.1",
        "symfony/flex": "^1.0",
        "symfony/framework-bundle": "^4.1",
        "symfony/lts": "^4@dev",
        "symfony/maker-bundle": "dev-master",
        "symfony/templating": "^4.1",
        "symfony/web-profiler-bundle": "^4.1",
        "symfony/yaml": "^4.1"
    },
    "require-dev": {
        "symfony/dotenv": "^4.1",
        "doctrine/doctrine-fixtures-bundle": "^2.3"
    },
    "config": {
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php71": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php56": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": true
        }
    }
}

===> FYI, Since our last conversation i try to change conf/twig.yaml

twig:
    paths: 
        '%kernel.project_dir%/templates' : ~
        '%kernel.project_dir%/vendor/2lenet/easyadmin-plus-bundle/src/Resources/views/form/' : LleEasyAdminPlusBundle
    debug: '%kernel.debug%'
    strict_variables: '%kernel.debug%'
    form_themes:
        - '@LleEasyAdminPlusBundle/form/widget.html.twig'

Now, the error is :

Unable to find template "@LleEasyAdminPlusBundle/form/widget.html.twig" (looked into: /Applications/MAMP/htdocs/smArt/Gallery/vendor/2lenet/easyadmin-plus-bundle/src/Resources/views/form).

Thanks you for your assistance.

Best

netproject0 commented 6 years ago

@sebheitzmann : Ok for tree filter i've got it :) "Embrouillage de pinceaux"

sebheitzmann commented 6 years ago

for the template problem could you please do the following :+1:

composer require templating

frameworks:
  templating:
      engines: ['twig']
netproject0 commented 6 years ago

Ok my error about "widget.html.twig" have now disappear ! Thank a lot !

netproject0 commented 6 years ago

@sebheitzmann Last problem, I promise... When i try to display the tree i've a new error

Uncaught PHP Exception Twig_Error_Runtime: "Impossible to access an attribute ("id") on a boolean variable ("")." at /Applications/MAMP/htdocs/smArt/Gallery/vendor/2lenet/easyadmin-plus-bundle/src/Resources/views/default/list.html.twig line 210

My easy_admin.yaml :

Service:
            class: App\Entity\OeuvrechCategorization
            tree: true
            disabled_actions: []
            list: 
                title: 'Catégorisation des Oeuvres'
                help: 'help ?'
                max_results: 500

And thank you so much for your help Best.

sebheitzmann commented 6 years ago

I thinks that this problem is know resolved. The problem was with the order by on the table. It must be ordered by root_id and lft. But EasyAdmin only let you specify one sort field. I have forced the order in nested tree. By the way you can't set another order if you want a tree view.

Sorry for the late answer