Giter Club home page Giter Club logo

eav-manager's Introduction

CleverAge/EAVManager

Help needed
This documentation is a work in progress, we need help to write guides and cookbooks
Don't hesitate to create issues if you want to speed up the process for a particular feature

What's inside?

The "EAV Manager" or "Clever Data Manager" (CDM) is an extensive set of tools designed to build business-oriented data repositories in Symfony.

It consists of several bundles put together to speed-up data modeling, data transformation and user interface development.

Philosophy

The CDM was designed using the same philosophy than the Symfony framework, using many small independent "bricks" that provide simple but easily extendable features.

We didn't want to create a full-stack solution with a huge coupling between its components but instead focus on keeping things simple and reusable.

Installation

Either use the EAVManager starter kit or follow these steps:

Components

To understand the various configurations needed in order to create a full-scale application using this bundle, you need to take a look at the inner components under the hood:

Configuration

You need to check several different bundle documentation that are stored in different places:

Only the checked entries are completed.

Cookbooks

Only the checked entries are completed.

Basics

Data management

Internationalization

Going further

Customizing

Advanced concepts

eav-manager's People

Contributors

blacxi avatar dom18fr avatar fabiensalles avatar mveyrenc avatar vincentchalnot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eav-manager's Issues

Many to Many not loaded

It seems that many to many relations are only loaded on one side : I have a Publication and an Author which are linked with a middle-entity PublishedPublications.

$publication->get('publishedPublications'); // return a collection with several elements

$authors->get('publishedPublications'); // return an empty collection

Filtering and pagination not working together

The filtering is not related to the pagination system, so when filtering, the list is truncated : it displays a list containing 5 elements per page instead of more, because they are filtered.

The query to display ids should have the filter too to keep consistency.

Form and QueryBuilder should not be build in the same class

To respect the separate of concerns, one single class should not build a form, handle the form, create a query builder, handle sorting, handle filtering.

As all is in a single class, it is not possible to debug or to change something when the sorting does not work for instance....

api-platform json-ld PUT request error

Hello, I have an error with json-ld PUT request. It seems that id format /api/resouces/{id} is not handled.

My request:
Screenshot from 2019-11-19 10-15-41

From the exception stack trace: I tried to debug:
Screenshot from 2019-11-19 10-18-33

and here is where the untranslated id is used to search for the entity
Screenshot from 2019-11-19 10-19-44

This is the stack trace:
Screenshot from 2019-11-19 10-26-01

Thank you!

The base template should be configurable

Actually the only way to customize the base template seems to use the Twig template overriding process. This is not very convenient and not a very good practice.

It is more easier to have a configuration option :

# config/config.yaml
cleverage_eav_manager:
    admin:
        base_template: my_little_template.html.twig
# ...

Error with referer values

It seems that referer values does not work anymore. When calling a referer value in a getter, a recursion error appears : "Maximum function nesting level of '256' reached, aborting!"

Add a way to debug data in database

As the the database is not human readable any more, the EAV should add a way to see cleary data.

I do not understand : for now, to debug, you have to make complex SQL queries to know which data have been inserted with two tables and many joins which is way more complex than normal Doctrine model.

The whole paradigm is wrong....

Error when adding a date range filter

When adding a date range filter, an error occurred when using this filter :

Cannot read index "startDate" while trying to traverse path "[startDate]". Available indices are "Array

The config is the following :

sidus_admin:
    configurations:
        publication:
            controller_pattern:
                - 'CleverAge\EAVManager\AdminBundle\Action\EAV\{{Action}}Action'
            template_pattern:
                - '@CleverAgeEAVManagerAdmin/EAVData/{{action}}.{{format}}.twig'
                - '@CleverAgeEAVManagerAdmin/Base/{{action}}.{{format}}.twig'
            entity: '%sidus_data_class%'
            prefix: /publication
            form_type: '%eav_form.type%'
            actions:
                list:
                    path: /{familyCode}/list
                create:
                    path: /{familyCode}/create
                read:
                    path: /{familyCode}/read/{id}
                edit:
                    path: /{familyCode}/edit/{id}
                delete:
                    path: /{familyCode}/delete/{id}
            options:
                icon: database
                families:
                    Publication: ~

sidus_data_grid:
    configurations:
        Publication:
            query_handler:
                provider: sidus.eav
                options:
                    family: Publication
                sortable:
                    - id
                    - type
                    - scriptaId
                    - title
                    - subTitle
                    - creationDate
                    - publicationDate
                filters:
                    type:
                        type: choice
                        form_options:
                            choices:
                                article.academic: ACA
                    title: ~
                    author:
                        attributes: [publishedPublications.author]
                        type: author_list
                        form_options:
                            choice_label: lastName
                            allowed_families:
                                - Author
                    scriptaId:
                        form_options:
                            label: admin.filter.scripta_id
                    creationDate:
                        type: date_range
            
            columns:
                id:
                    label: "#"
                type: ~
                scriptaId: ~
                title:
                    template: '%clickable.template%'
                subTitle: ~
                authors:
                    template: publication/list/_authors.html.twig
                creationDate: ~
                publicationDate: ~
                actions:
                    template: publication/list/_actions.html.twig
            
            actions:
                create: '%create.button%'
            
            reset_button:
                attr:
                    data-target-element: '#tg_center'

Serializer fails if an entity is not managed by EAV

When using the serializer into a project using the EAV bundle, the EAV Entity provider fails if an entity is not managed by EAV. It means that all entity/object which should be serialized should be managed by EAV, even if it is not stored in database.

Serialization should be a separate process from database. It could add helper, but it should not fail when deserializing an entity not managed. It should preserve the original behavior of the Symfony serializer.

UserManager should use UserInterface

It will be good if the UserManager can use UserInterface instead of User in its methods parameters. This way it will be more integrated with other security components which use UserInterface.

Performance issues

To load a page with 10 records and less than 10 fields in each records, it takes 25 seconds to display.

It is way too long.....

Columns are not translated

It seems that columns of a datagrid does not use the translation system, so I can't be translated. Again we must override a lot of files.....

JS issue in admin with nested embedded

Test case

  • lastest version of the CDM
  • use this kind of model setup (embedded attribute with multi values containing another embedded attribute) :
        OrderFulfillment:
            attributes:
                items:
                    type: embed_multi_family
                    multiple: true
                    options:
                        allowed_families:
                            - OrderFulfillmentItem

        OrderFulfillmentItem:
            attributes:
                orderItem:
                    type: embed_multi_family
                    options:
                        allowed_families:
                            - OrderItem

Result

  • the second data inside "items" takes the place of the first (database is ok)
    capture d ecran 2018-04-11 a 11 52 03-fullpage

JS does not work anymore with the last version

I know I must not update, but when removing the dotenv component because EAV is too old, the js build was updated, but not the link to the file. This cause another 404 in production......................

Sorting is broken

Sorting with EAV does not work with strings. When sorting, name are not sorted rightly. But it works without EAV...

Allow nullable ids in findBy query

When retrieving an entity using the finder, if the entity has relations and the query is on those relations, passed entities should always have an id. If not, an exception is thrown.

This forces the developer to write code like this :

if ($author->getId() && $publication->getId()) {
                $publishedPublication = $this->finder->findOneBy($family, [
                    'author' => $author,
                    'publication' => $publication,
                    'type' => $type,
                ]);
            }

Maybe the finder should just return in such case.

SimpleDataSelectorType - Performance and Usecase trouble

When I use SimpleDataSelectorType on edition mode :

  • the option max_results is set with the default value 100 ; if I edit a content with a relation not in the first 100 results of the linked entity, the relation displayed is wrong ;
  • if unset max_results to get all linked entities, there is a huge problem of performance (a huge number of requests).

Bug on pagination and filters

When using a filter, the returned results are not correct and the pagination is broken. For instance, the pagination says 25 results are returned and 2 pages are available, but only 3 results are displayed on each page...

And as it is EAV model, it is not possible to debug in database....

User actions not granted - Actions buttons displayed

When I'm logged with a user without any admin roles and configured this user with a FamilyPermission (List and Read only), there're some unwaiting displayed buttons :

  • /list : the create button
  • /edit : all

Bisous <3

[UserBundle] We can't override User entity

Hello,

I tried to update User entity. I created a new class :

use CleverAge\EAVManager\UserBundle\Entity\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
 
/**
 * Class User
 *
 * @package Jardiland\CleverAge\EAVManager\UserBundle\Entity
 *
 * @ORM\Entity(repositoryClass="Jardiland\CleverAge\EAVManager\UserBundle\Repository\Doctrine\DoctrineUserRepository")
 * @ORM\Table(name="eavmanager_user")
 */
class User extends BaseUser
{
 
}

I also created a doctrine listener to define the original class to mappedSuperClass in order to create doctrine inheritance :

use CleverAge\EAVManager\UserBundle\Entity\User;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;

class UserListener
{
    /**
     * Update User entity
     * @param LoadClassMetadataEventArgs $eventArgs
     */
    public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
    {
        $classMetadata = $eventArgs->getClassMetadata();

        if ($classMetadata->getName() !== User::class) {
            return;
        }

        $classMetadata->isMappedSuperclass = true;
    }
}

But when I tried to test my doctrine mapping with bin/console doctirne:schema:update --dump-sql, I had this error :

[Doctrine\ORM\Mapping\MappingException]                                                                                                           
  It is illegal to put an inverse side one-to-many or many-to-many association on mapped superclass 'CleverAge\EAVManager\UserBundle\Entity\User#f  
  amilyPermissions'.      

I think, it would be nice to have the mapping of the $familyPermissions property with an inversedBy attribute instead of its opposite : mappedBy

Add events to allow customization without dependencies

I will be nice if we could have events on each parts of the EAV.

For example :

  • Admin events (_PRE_CREATE_FORM, _POST_CREATE_FORM)
  • EAV Events (PRE_CREATE_EAV, POST....)

This allow to customize the EAV in a simpler way than overriding all.

Error on the default menu link to "User"

When using the starter-kit, a default menu is generated when adding an User, on the left bar menu. The link leads to an error page as the User family does not exist.

Message : "No family with code : User"

Improve the sort and filter system

It is nearly impossible to add a custom filter or a custom sort without overriding a lot of core classes. This should not be done this way. A simple yaml configuration is more convenient, like in the resource bundle.

Identifier constraints shared between Families

I have a first family called Brand

sidus_eav_model:
    families:
        Brand:
            data_class: AppBundle\Entity\Brand
            instantiable: true
            attributeAsIdentifier: code
            attributeAsLabel: label
            attributes:
                code:
                    type: string_identifier
                label:
                    type: string

and a second family called Gipa

sidus_eav_model:
    families:
        Gipa:
            data_class: AppBundle\Entity\Gipa
            instantiable: true
            attributeAsIdentifier: code
            attributeAsLabel: label
            attributes:
                code:
                    type: string_identifier
                type:
                    type: string
                label:
                    type: string

The both families are identified by an attribute named code.

If I have imported a Brand line with a code value "ZE", I cannot import a Gipa line with the code value "ZE".

[UnexpectedValueException]
  Invalid fixtures data for family 'Gipa' (reference: ZE) and property 'code' : 'The same value already exists', given 'ZE'

Bugs in the options resolving for buttons

When resolving options for buttons in forms, a merge is made with a default options array. As it is not a recursive merge, if we define options in configuration, it can be overwritten by defaults one...

Adding values to a multiple fields is not working

As said in documentation to have a collection we should add multiple to our field. But this does not work as the collection is not mapped to the EAV value :

$publication->get('publishedPublications')->add($publishedPublication);
dump($publication->get('publishedPublications'));

Doctrine\Common\Collections\ArrayCollection {#3386
  -elements: []
}

Missing ids when using findOneBy

When I use the findOneBy method of the finder, I have the following exception :

In ProcessManager.php line 315:
                                                                                                                                      
  Process academic_article has failed during process publication_mapping with message: 'Binding entities to query parameters only al  
  lowed for entities that have an identifier.'.                                                                                       
                                                                                                                                     
In ORMInvalidArgumentException.php line 207:
                                                                                           
  Binding entities to query parameters only allowed for entities that have an identifier.  

But my code looks like this :

if ($author->getId() && $publication->getId()) {
                $publishedPublication = $this->finder->findOneBy($family, [
                    'author' => $author,
                    'publication' => $publication,
                    'type' => $type,
                ]);
            }

And if I dump the content of ids before the crash :

35943
39628
10:46:30 CRITICAL  [cleverage_process_task] Binding entities to query parameters only allowed for entities that have an identifier. ["process_id" => 1574243070.9765,"process_code" => "academic_article","process_context" => [],"task_code" => "publication_mapping","task_service" => "App\Task\Publication\PublicationMappingTask"]
10:46:30 ERROR     [console] Error thrown while running command "cleverage:process:execute academic_article". Message: "Process academic_article has failed during process publication_mapping with message: 'Binding entities to query parameters only allowed for entities that have an identifier.'.
" ["exception" => RuntimeException { …},"command" => "cleverage:process:execute academic_article","message" => "Process academic_article has failed during process publication_mapping with message: 'Binding entities to query parameters only allowed for entities that have an identifier.'.\n"]

The ids of my entities are filled with values.

Forms should be separated

It is not a good practice to have a whole bug form for separated data as filters for example. Forms should be separated to ease extensions

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.