entity-attribute-value

How to store meta-data on columns

别等时光非礼了梦想. 提交于 2019-11-30 02:19:23
Let's say you're collecting insider info on upcoming superhero movie releases and your main Movie table looks something like this: Table 1 Title Director Leading Male Leading Female Villain -------------------------------------------------------------------------- Green Lantern Kubrick Robert Redford Miley Cyrus Hugh Grant The Tick Mel Gibson Kevin Sorbo Linda Hunt Anthony Hopkins This should work very well in general and allow very easy queries as well as comparisons between rows. However, you'd like to track the source of each data fact, as well as the name of the journalist who discovered

Can EntityFramework support an EAV model?

断了今生、忘了曾经 提交于 2019-11-29 23:23:10
Can EntityFramework support an EAV model? Is this a workable scenario, or a nightmare? I want to use an EAV model for a system, and I'd like to embrace EF if possible, but I'm concerned that these two philosophies are in conflict. Ladislav Mrnka It depends how do you expect to use EAV in the application. EF can be used to map this: public partial class Entity { // Key public virtual int Id { get; set; } // Other common properties // Attributes public virtual ICollection<EavAttriubte> Attributes { get; set; } } // The simplest implementation public class EavAttribute { // Key public virtual int

How do you model custom attributes of entities?

…衆ロ難τιáo~ 提交于 2019-11-29 21:08:52
Let's say we're having an application which should be able to store all kind of products. Each product has at least an ID and a Name but all other attributes can be defined by the user himself. E.g. He could create a productgroup Ipods which would contain attributes capacity and generation E.g. He could create a productgroup TShirts with the attributes size and color We need to store the definition of a product and the concrete products itself. We want to ensure that it is easily possible to aggregate (GROUP BY) by product attributes. E.g. select the total sum of capacity for each generation

Symfony2 - how to create form based on dynamic parameters from db? (EAV)

那年仲夏 提交于 2019-11-29 20:31:38
I would like to create form based on dynamic parameters that are stored in DB. So I've created an entity called Parameter that defines parameter name, which should be displayed as form field label. /** * @ORM\Entity */ class Parameter { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @ORM\Column(type="string", length="255") * @Assert\NotBlank() */ protected $name; /** * @ORM\OneToMany(targetEntity="ParameterValue", mappedBy="parameter") */ protected $values; Parameter values for specific object (Company object) are about to be stored

is EAV - Hybrid a bad database design choice

我们两清 提交于 2019-11-29 20:30:46
We have to redesign a legacy POI database from MySQL to PostgreSQL. Currently all entities have 80-120+ attributes that represent individual properties. We have been asked to consider flexibility as well as good design approach for the new database. However new design should allow: n no. of attributes/properties for any entity i.e. no of attributes for any entity are not fixed and may change on regular basis. allow content admins to add new properties to existing entities on the fly using through admin interfaces rather than making changes in db schema all the time. There are quite a few

(Database Design - products attributes): What is better option for product attribute database design?

落花浮王杯 提交于 2019-11-29 20:12:40
I new in database design. What is better option for product attribute database design for cms?(Please suggest other options also). option 1: 1 table products{ id product_name color price attribute_name1 attribute_value1 attribute_name2 attribute_value2 attribute_name3 attribute_value3 } option 2: 3 tables products{ id product_name color price } attribute{ id name value } products_attribute{ products_id attribute_id } Bill Karwin You're making a common mistake of database design, storing name in one column and value in another column. This is not a relational database design. Each attribute

Keeping page changes history. A bit like SO does for revisions

对着背影说爱祢 提交于 2019-11-29 18:11:38
问题 I have a CMS system that stores data across tables like this: Entries Table +----+-------+------+--------+--------+ | id | title | text | index1 | index2 | +----+-------+------+--------+--------+ Entries META Table +----+----------+-------+-------+ | id | entry_id | value | param | +----+----------+-------+-------+ Files Table +----+----------+----------+ | id | entry_id | filename | +----+----------+----------+ Entries-to-Tags Table +----+----------+--------+ | id | entry_id | tag_id | +----

Magento category ID from product ID

与世无争的帅哥 提交于 2019-11-29 07:22:06
In magento how to get the category id of each product from its product ID. $items = $request->getAllItems(); $c = count($items); for ($i = 0; $i < $c; $i++) { if ($items[$i]->getProduct() instanceof Mage_Catalog_Model_Product) { if ($items[$i]->getProduct()->getId()) { $this->_dhlAllowed = false; } } } Here $items[$i]->getProduct()->getId() returns product ID. I want its category ID. public function getProductCategory() { /* @var $product Mage_Catalog_Model_Product */ $product = Mage::registry('current_product'); if ($product->getId()) { $categoryIds = $product->getCategoryIds(); if (is_array(

MySQL correlated subquery in JOIN syntax

十年热恋 提交于 2019-11-29 07:14:01
问题 I would like to provide a WHERE condition on an inner query by specifying innertable.id = outertable.id. However, MySQL (5.0.45) reports "Unknown column 'outertable.id' in 'where clause'". Is this type of query possible? The inner query is pivoting rows to columns using a GROUP BY. This could be entirely be performed in the outer query, but would possibly incur additional overhead due to the extra joins. Alternatively, I can leave off the WHERE condition in the inner query and instead specify

mysql table structure proposal?

喜夏-厌秋 提交于 2019-11-29 03:13:19
问题 is this table any good for mysql? I wanted to make it flexible in the future for this type of data storage. With this table structure, you can't use a PRIMARY KEY but an index ... Should I change the format of the table to have headers - Primary Key, Width, Length, Space, Coupling ... ID_NUM Param Value 1 Width 5e-081 1 Length 12 1 Space 5e-084 1 Coupling 1.511 1 Metal Layer M3-0 2 Width 5e-082 2 Length 1.38e-061 2 Space 5e-081 2 Coupling 1.5 2 Metal Layer M310 回答1: No, this is a bad design