I am trying to create a taxonomy similar to this:
Category 1
Category 1.1
Category 1.2
Category 2
Category 2.1
Category 2.2
etc.
It is possible to create taxonomies based on group selections of hierarchical content, but at the time of the selection, the hierarchy is not visible. Having a complex taxonomy requires exposing this visual hierarchy as it is not possible for the editor to memorize what sub- (and sub-sub-!)categories belong to which parents.
Also, selecting Category 2.2 should automatically select Category 2.
Are these a possibility?
Related
I have a document based core data app with entity "Languages". This entity has two permanent attributes "key" and "comments".
Is it possible programmatically add and remove additional attributes during runtime ("language_1", "language_2", etc.) ?
My goal is to avoid creating table with let say 50 attributes when user needs only few (I don't know upfront how many attributes will be necessary).
Or maybe I should choose other solution ? :)
EDIT
Case explanation:
When user creates new document, table "Languages" has only 2 attributes "key" and "comments". During working with the document user can any time add or remove language(s) - I mean attributes (columns) not rows in the table.
My goal is to have dynamic entity like below.
Yes, it's possible. But it's probably not what you want. You'd have to recreate the amended Managed Object Model, for each document, at runtime whenever the document is opened.
After seeing your sketch, I suggest a slightly different model. By the way, best style is to use singular nouns for Entities ("Section", not "Sections), plural nouns for to-many Relationships ("sections", not "relSection"), and omit the entity name in its attributes ("comment", not "sectionComment").
Use one Entity for your permanent attributes. Call it "Word". Word has attributes "comments" and "key", and to-many relationships "translations" and "sections". On the other end of the "translations" relationship is a Translation entity, which has attributes "text" and also perhaps the name of the language (either as a string or as another relationship).
Something like this:
For your first example, you'd have one instance of Word, 3 instances of Translation (.text = Home, Zuhause, and Casa), and 3 instances of Language (.name = English, German, Spanish). When you add the second line, you'll get 1 more instance of Word, 3 more instances of Translation, but 0 more Languages. Add the new Translation instances to the existing Language's "translations" relationship instead.
The objective:
Having a many-to-many relation be displayed as a dynamic list of select inputs(single choice dropdown list)
User arrives on page with a single select field (multiple = false) populated with persisted entities and add/remove buttons. By clicking the add button, a new select field with the same options appears below the first, which adds a new entry in the M2M relation. By clicking remove the field disappears and the entry should be removed.
The model:
Two entities: User & Manager. A User has exactly one "special" Manager and unlimited normal Managers.
Managers manage unlimited users.To model this I have created two relationships for which the user is the "owner" (not sure how to translate this)
ManyToOne specialManager
ManyToMany normalManagers
I haven't created a many to many relationship with attribute "special" because the requirement is exactly one special manager and I wasn't sure if Symfony/Doctrine would cause problems down the line.
What I have:
I can display a multiple select field with the existing entities using Entity field type, as per the documentation. Functionally this is what I need, visually it is not.
I can also use the Collection field type to display a single text field, and add or remove more with JS, as per the documentation. Visually this is what I need, but The text fields (entity attribute) need to be replaced by choice field.
The question:
Before I continue digging, is there a simple way to achieve this list of select tags?
For anyone else who may eventually need a dynamic list of select fields:
I initially solved this issue by detaching the field(s) in event listeners, and handling the display/submission manually in the controller.
However I wasn't satisfied with this clunky solution and when I encountered the same need I used a second solution: creating an intermediary entity xxxChoice (in this case ManagerChoice) which is Mto1 inversed related to User and Mto1 related to Manager. Then by creating a ManagerChoiceType form with "Manager" entity field type I was able to easily display my collection of dropdown select lists.
I have a ProductCategory class that has a parent and some children, properly annotated using Doctrine.
Then I have a ProductCategoryType (form class) that I use to render the html form.
Doctrine does its magic and creates a select box for parent which consists of previously added categories.
My problem: How to I prepend a default option (say '0' => 'No parent category') and how do I remove a particular category from list (ex: the currently edited category, so user can't select the very category to be its own parent)?
This can easily be achieved by using DataTransformers.
You can find more information in the documentation chapter How to use Data Transformers.
I created a EMF ecore model that could look like this:
The model contains a list of Family
The model contains a list of VisitedCountry
A Family contains a list of Individual
A VisitedCountry contains a list of references to some Individuals
after the plugins EMF-Edit and EMF-Editor have been generated and when I run the generated GUI: when I click an Indvidual, is there a way to display a table listing all his VisitedCountry ?
To easily do that, you could add a non-containment reference from Individual to VisitedCountry, which must be an opposite reference (EOpposite) to the reference you defined from VisitedCountry to Individual.
Doing that, you could check when selecting an Individual when editing your model with the generated model editor, you can access their VisitedCountry in the Properties View. In general defining EOpposite references beetween classes is always useful for other puposes, since you have bidirectional navigation between both classes.
I have an Order, OrderItem and Stock entity. Basically, an order is created and then items can be added to the Order. An Order can have more than one item. Each item in the order is where the OrderItem comes into play.
My question is this: What attributes should I have for the order item class?
Currently I only have the primary key to identify it.
Should I have anything else?
I do not need any of the details for the items in the order as all the details for each item is in the Stock class.
Here is am image of what I am talking about:
What you 'need' to have will come down to wider requirements. Some things you might consider though:
You've included identifiers (keys) on the classes. You might also therefore want to include referentials (foreign keys) in Order Item - one each for Order.ordId & Stock.stkID respectively.
Do you need quantity? i.e. how many of each Stock item in each order? (e.g. 2 copies of "Lord of the Rings" if the stock items are books).
Date / time the order was placed?
Order status? (Confirmed/Shipped/Delivered/Cancelled etc.)?
Those are common things to find in such a scenario; which apply will depend on what you need to achieve.
hth.