定制 xorgxx/neox-table-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xorgxx/neox-table-bundle

Composer 安装命令:

composer require xorgxx/neox-table-bundle

包简介

simple for you to manage integration "crud"

README 文档

README

!!! This bundle is end life !! consider to install Please NeoxMakeBundle !!!

This bundle provides a simple and flexible to manage crud render in your application. Its main goal is to make it simple for you to manage integration "crud" render and to let you configure less common ones with ease. Be aware that there is no testing code !

2023-05-24-12-05-31.png 2023-05-05-00-08-37.png

Installation BETA VERSION !!

Install the bundle for Composer !! as is still on beta version !!

  composer require xorgxx/neox-table-bundle
  or 
  composer require xorgxx/neox-table-bundle:0.*

Make sure that is register the bundle in your AppKernel:

Bundles.php
<?php

return [
    .....
    NeoxTable\NeoxTableBundle\NeoxTableBundle::class => ['all' => true],
    .....
];

NOTE: You may need to use [ symfony composer dump-autoload ] to reload autoloading

..... Done 🎈

Configuration

No configuration except that you have install stimulus/turbo-ux and setup correctly !! Base css on Bootstrap 5 so if you have install on your project all css and js from Bs5 going to be applique.

How to use in console ? symfony console neox:table:crud

 The class name of the entity to create --> NeoxTable !! <-- CRUD (e.g. Deliciou
sGnome):
 > 

Enter name entity that you want to "crud"

 Choose a name for your controller class (e.g. TestController) [TestController]:
 >

Enter path that you want for create controller ex: Admin\test\crud

 Do you want to generate tests for the controller?. [Experimental] (yes/no) [no]
:
 >

Yes or no generate tests ?

that all !! it will generate for you all :

project
│   assets
│   bin
│   config
|   ....
└─── src
│   └─── Controller
│       └─── Admin
|           └─── test
|               └─── crudController.php
|   └─── Form
|       └─── TestType.php
└─── templates
|   └─── admin
|       └─── test
|           └─── _delete_form_html_twig
|           └─── _form.html.twig
|           └─── crud.html.twig
|           └─── index.html.twig
|           └─── show.html.twig
└─── translations
|   └─── test.fr.yml

Them you need to setup one line at liste in controller :

└─── src
│   └─── Controller
│       └─── Admin
|           └─── test
|               └─── crudController.php

Import class in your controller : buttonBuild and NeoxTableBuilder !

use NeoxTable\NeoxTableBundle\Controller\_NeoxCoreController
use NeoxTable\NeoxTableBundle\Service\NeoxTableBuilder;
use NeoxTable\NeoxTableBundle\Service\buttonBuild;
    /**
     * @throws NonUniqueResultException
     */
    #[Route('/', name: 'app_admin_post_crud_index', methods: ['GET'])]
    public function index(Request $request, PostRepository $postRepository): Response
    {
//        $header =  (new buttonBuild())
//            ->setLabel("Back Post")
//            ->setRef($this->generateUrl("app_admin_post_crud_index") )
//            ->setClass("button-info bd-highlight")
//            ->setStyle("height: 30px", true)
//            ->setIcon("bi-arrow-left-square")
//            ->build();

        $neoxTable = $this->getNeoxTableBuilder()
            ->filterFields("#, title, summary, author.email@user", "post") 
            ->setEntity($postRepository->findAll())
//            ->setActButton($header,"h")
            ->setActButton("@app_admin_post_crud")

        ;

        // 🔥 The magic happens here! 🔥
            if ( $this->getNeoxTableBuilder()::checkTurbo($request) ) {
            return $this->render('@NeoxTable/neoxTable.html.twig',["neoxTable" => $neoxTable  ]);
        }

        return $this->render('admin/post/crud/index.html.twig', [
            'neoxTable' => $neoxTable,
        ]);
    }

As you can see : 🔥 The magic happens here! 🔥 YES it's made with Magic of Turbo-ux

->filterFields("#, title, summary, author.email@user", "post", [...]) <----- !!here

Add all field that you need to see in render table. *if you have relation in entity : author.email@user [@ is use to give domaine name for translator]

NOTE: You can add any button manually in header or in table colonne. Also new syntax will come to add button as you want!

        $header =  (new buttonBuild())
            ->setLabel("Back Post")
            ->setRef($this->generateUrl("app_admin_post_crud_index") )
            ->setClass("button-info bd-highlight")
            ->setStyle("height: 30px", true)
            ->setIcon("bi-arrow-left-square")
            ->build();
            
        New syntax :
            $header =  (new buttonBuild())
              ->setType("@")
              ->setAdd('<a href="/site-quotation" class="button m-0 button-circle button-large text-white" style="background-color: #084678;">Estimation gratuite ...</a>')
              ->build();
        !!! Important NOTE !!!
        to set turbo mode setTurbo() ->setTurbo("data-turbo='true'")
        TODO additionnal data-xxx
              
        them to send to builder :
            $this->setButton($header, [Tag {a} to create action button; {h} to create header button]);

2023-05-24-12-05-32.png

This generates for you all standard button crud : add - delete - pin - edit -- return

    ->setActButton("@app_admin_post_crud")  --> all button header and table colonne
    ->setActButton("#app_admin_post_crud")  --> only button table colonne

If you need to add special Js or css

    ->styling([...template.html.twig...])

Add voter on action bar: if you set in your project voter on entity it will recognise

    public const NEW    = 'NEW';
    public const EDIT   = 'EDIT';
    public const PIN    = 'PIN';
    public const VIEW   = 'VIEW';
    public const DELETE = 'DELETE';

Now possibility to add "filter" and "function" Twig

    ->filterFields("#, title, description, position, faqsDomaine.value, category#join('|')|raw", "faq")
    or to give custome one
    ->filterFields("#, title, description, position, faqsDomaine#enum, category#join('|')", "faq")

Contributing

If you want to contribute (thank you!) to this bundle, here are some guidelines:

  • Please respect the Symfony guidelines
  • Test everything! Please add tests cases to the tests/ directory when:
    • You fix a bug that wasn't covered before
    • You add a new feature
    • You see code that works but isn't covered by any tests (there is a special place in heaven for you)
    • ->> 🔥🔥 28/07/2023 have to update Controller.tpl.php according to new version Makebundle symfony how das not have anymore "repositoryHasSaveAndRemoveMethode"

Todo

  • Packagist

Thanks

xorgxx/neox-table-bundle 适用场景与选型建议

xorgxx/neox-table-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 70 次下载、GitHub Stars 达 2, 最近一次更新时间为 2023 年 05 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 xorgxx/neox-table-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 xorgxx/neox-table-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 xorgxx/neox-table-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 70
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2023-05-24