KnpLabs / DoctrineBehaviors

Doctrine2 behavior traits that help handling Blameable, Loggable, Sluggable, SoftDeletable, Uuidable, Timestampable, Translatable, Tree behavior
http://knplabs.com
MIT License
914 stars 294 forks source link

how to get string for translatable and tree use easyadmin 3 #606

Closed langziyang closed 3 years ago

langziyang commented 3 years ago

i use easyadmin 3 and knp.i have Category.php and CategoryTranslation.php.now when i configureFields on easyadmin controller how can get all parent category?

`<?php

namespace App\Entity;

use App\Repository\CategoryRepository; use Doctrine\ORM\Mapping as ORM; use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface; use Knp\DoctrineBehaviors\Contract\Entity\TreeNodeInterface; use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait; use Knp\DoctrineBehaviors\Model\Tree\TreeNodeTrait;

/**

namespace App\Entity;

use App\Repository\CategoryTranslationRepository; use Doctrine\ORM\Mapping as ORM; use Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface; use Knp\DoctrineBehaviors\Model\Translatable\TranslationTrait;

/**

`<?php

namespace App\Controller\Admin;

use App\Entity\Category; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;

class CategoryCrudController extends AbstractCrudController { public static function getEntityFqcn(): string { return Category::class; }

public function configureFields(string $pageName): iterable
{
    return [
        IdField::new('id'),
        //AssociationField::new('this is Category')
    ];
}

} `

TomasVotruba commented 3 years ago

Hi, I'm going through old opended issues and PRs to cleanup too-long-opened items and close them. Thank you for your contribution and time.

We needs a feature with test and passing CI to be able to merge it without letting a bug in. If this is still relevant for you, please add code with test and make CI pass first. Then we'll able to merge your feature without further waiting :+1:

Thank for understanding.