A small intro, I'm making a form builder on top of Yii Framework. All the fields get stored in the database, the rules are related to the fields, the saved data is related to an app version and the data field.
I'm being mindfucked when relating a data row to itself, so when it is cloned, it is related to the original row as well as cloning all the original relations? WTF did I just type?...
Here's a diagram:
WTF?
platform_version_form_field relate to eachother in more instances.
Instance 1.
When an option in a select list has been selected, the system checks if there is a relation to another field, if the condition matches, it does the verb, this is currently an enum of "enable", "disable", "display" and "hide". (e.g.: on select change -> if has relation & condition ? show related field : hide related field )
Instance 2.
All fields are related to forms which are related to platform versions, the other way round: platfrom_version has many platform_version_form has many platform_version_form_field. When creating a new platform_version, all the relations have to be able to be cloned. A new relation is also made to the field it was based on. So platform_version_form_field has one ? or has many ? platform_version_form_field?
Instance 3.
When a customer creates a new version of an App. The data has to be able to be cloned from a previous app based on a different platform_version.
Example: Customer has an app on iOS 6 and are ready to fill in the details about the new iOS 7 version. When they create a new iOS 7 app_version app_version_record is cloned from the iOS 6 version related through the platform_version_form_field, all the data is cloned to fields which have a correct relation.
I'm mindfucked. Someone explain what I'm doing?
[Mindfuck] MySQL PHP relating a table to itself (n:m)
[Mindfuck] MySQL PHP relating a table to itself (n:m)
Fighting for peace is declaring war on war. If you want peace be peaceful.
Re: [Mindfuck] MySQL PHP relating a table to itself (n:m)
So... basically you want one field to link everything to so you can send user information from one platform to another well possibly having different version running at the same time?
Relating everything by something else is confusing. If you're attempting what I think you are (and it's entirely possible I am way of the mark here) have one master database/table/whatever to start from. Maybe something that stores all locations of a clone, and the original location?Chris wrote:A small intro, I'm making a form builder on top of Yii Framework. All the fields get stored in the database, the rules are related to the fields, the saved data is related to an app version and the data field.
I'm being mindfucked when relating a data row to itself, so when it is cloned, it is related to the original row as well as cloning all the original relations? WTF did I just type?...
Re: [Mindfuck] MySQL PHP relating a table to itself (n:m)
Thanks!
I have to clone the fields and the records and relations. The relation records will have to be cloned and the match the x and y id pair.
I think a better solution might be to create a new table between app and app versions. This will help me separate the form logic and the saved data. Do refactoring and modulate the code.
I have to clone the fields and the records and relations. The relation records will have to be cloned and the match the x and y id pair.
I think a better solution might be to create a new table between app and app versions. This will help me separate the form logic and the saved data. Do refactoring and modulate the code.
Fighting for peace is declaring war on war. If you want peace be peaceful.
Re: [Mindfuck] MySQL PHP relating a table to itself (n:m)
I've changed the database around a bit to suite better. Fields will have siblings, the current field_relation logic has been renamed to field_trigger, which seems more appropriate for what it does.
Fighting for peace is declaring war on war. If you want peace be peaceful.