Comments (14)
The list of Doctrine (DBAL) type is defined here: http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html#mapping-matrix
From code, the list of type can be retrieve from the function getTypesMap()
of the class Doctrine\DBAL\Types\Type
$types = array_keys(\Doctrine\DBAL\Types\Type::getTypesMap());
The list of supported association of Doctrine (ORM) is available here:
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/association-mapping.html
Doctrine2 project defined a lot of models for testing purpose. But no fixtures (objects are generated per test)
But maybe models can be reused and we just have to create fixture for those models.
from easyadminbundle.
@MacFJA thanks for providing the exact references for types and associations.
In case anyone wants to work on this, what we're looking for is: The minimal set of Doctrine entities that use ALL the data types and define ALL the possible associations between them.
from easyadminbundle.
1) Check if Doctrine project defines that set of entities and fixtures and reuse it.
So far no fixture found, lots of entities, some of them cover a large part of possible association and field type
2) If not, check if SonataAdmin or any other existing admin generator bundle defines that set of entities and fixtures and reuse it.
I check sonata-project/SonataAdminBundle, Symfony's DoctrineBundle, Snowcap/SnowcapAdminBundle, mgiagnoni/LyraAdminBundle. But none of them have entities (that cover must of case) neither fixtures to generate a consistent database.
3) If none of the previous points succeed, create that set of entities + fixtures for EasyAdmin.
I just define a little UML diagram of an believable set of entities to have an overview
So, for now I have:
- Association
- ManyToMany (Category/Product + Product/Order)
- Self referencing (Category/Category)
- ManyToOne & OneToMany (Product/Image + Image/Product)
- Field type
- string
- datetime
- datetimetz
- simple_array
- bigint
- boolean
- integer
- float
- text
- blob
- binary
- guid
- date
- json_array
- time
Still missing some requirement
from easyadminbundle.
@MacFJA amazing! Thanks a lot for your work!
In the entity set that you've prepared, the only missing types that I see are: array
, decimal
, object
and smallint
. And the only missing association is one-to-one non-self-referencing
.
Ii would be great if someone could help @MacFJA think about which fields to add to these entities to actually use every possible Doctrine type.
After that, it would be very helpful if you could export the UML diagram to actual Doctrine PHP entities. Then, I'll prepare the fixtures. Thanks!
from easyadminbundle.
Maybe a serialized non-stdclass object (like a non-entity class) ?
from easyadminbundle.
Here it is my proposal for adding the remaining data types and associations:
Relations
- Create a new
OrderItem
entity with aone-to-many
relation withOrder
(and movequantity
fromProduct
toOrderItem
). - Add a
many-to-one
relation betweenProduct
and the newOrderItem
entity. - Simplify relation between
Product
andGallery
toone-to-one
relation.
Data types
- In
Product
entity add a newfeatures
property of typearray
. Example:$features = array('feature_1_name' => 'feature_1_value', ...);
- In the
OrderItem
entity, add ataxRate
property of typedecimal
. Example21.5
(%) - In
OrderItem
, replace thequantity
type frominteger
tosmallint
- In
Order
, replace theincrementId
type frombigint
toint
. - In
Order
, replace theshippingAddress
property byshipment
and replace its type fromjson_array
toobject
type. Example:class Shipment { public $address; $public shippingCompany; public $cost; ... }
from easyadminbundle.
Here the version of the UML diagram:
from easyadminbundle.
@MacFJA great! I'm sure that some purists would scream if they see this schema ... but it's perfect for our purposes: all types and all associations using the minimal set of entities!
I wonder if it's easy to transform the UML diagram that you made into Doctrine entities. If you can, please email me those PHP files to [email protected]
. Then, I'll prepare the fixtures to be able to test them in a real backend. Thanks!
from easyadminbundle.
Depending on the software it can be transposed to MySQL table definitions, like with JMerise or MysqlWorkbench. Then with the table def, you can use doctrine-reverse-mapping to generate a bunch of entities based on this diagram.
from easyadminbundle.
The diagram was created with ArgoUML, and lots of information are missing or not exact. I prefer make all the classes "by hand" to be sure that all convention in the doctrine documentation are respected. And some case must by handling manually (for instance the case of the ManyToMany association, which side is responsible of the creation: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/association-mapping.html#owning-and-inverse-side-on-a-manytomany-association)
Here the full test set: MacFJA/Doctrine-TestSet
(Fixtures for products and categories in preparation)
from easyadminbundle.
@MacFJA awesome! Thanks for working on this and for doing it so well. I'm really looking forward to use your entities to improve this bundle. Thanks.
from easyadminbundle.
@MacFJA I've prepared a demo Symfony backend which includes your entities: https://github.com/javiereguiluz/easy-admin-demo I'll use this project to work on adding support for associations: https://github.com/javiereguiluz/EasyAdminBundle/issues/124
Do you have some fixtures that we can use to fill in the backend or do you prefer if I prepare those fixtures? Thanks!
from easyadminbundle.
@javiereguiluz I just push fixtures for products, categories and images.
Still missing lots of contents 😞
I have to make fixtures for order's side (Order, OrderItem, Shipment) and add more features for products.
In my todo list I also have the packagist publication and a nicer way to import data (for now we have to call doctrine command line to create database, index.php to inject fixture)
from easyadminbundle.
Closing it as "fixed" in https://github.com/javiereguiluz/easy-admin-demo. It's still not completed, but we can close this issue because the initial work is done. Thanks @MacFJA for working on this.
from easyadminbundle.
Related Issues (20)
- [4.9.1] Action::linkToRoute does not handle reverse proxy context HOT 1
- Assets does not included for embedded crud form fields HOT 1
- Some bootstrap functionnalities don't work if we use stimulus HOT 3
- Use AdminUrlGeneratorInterface instead of AdminUrlGenerator directly HOT 1
- Allow fields containing null-safe property paths HOT 1
- AdminUrlGenerator always includes entityId, even when it should redirect to the Index page HOT 4
- setHtmlAttributes methods doesn't create multiple attributs HOT 1
- custom voter case self::NEW: HOT 1
- Collection::allowDelete should still allow deletion of unsaved items HOT 4
- ChoiceField select html choices in CollectionField
- Dynamic Form Fields
- crud edit header - border is not visible / css HOT 1
- CollectionField with json
- Allows ToggleSwitch to dispatch a subscribable event
- Search not working with POSTRGES HOT 7
- Toggle switch on/off not working HOT 2
- Association Entity Return value must be of type string, null returned HOT 1
- [BUG UI] Highlight search results in darkmode not lisible
- PR #6200 : Unsupported operand types: string + int HOT 4
- Asterisks in the required form fields are only visible once
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from easyadminbundle.