Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content and contentformat moved among base fields #959

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kordan
Copy link
Owner

@kordan kordan commented Mar 23, 2024

As part of a work of standardization and modernization of the module aimed at making the code homogeneous and, consequently, easily understandable and modifiable, I realized that the use of PHP 8.2 highlights a significant and very long series of errors that I must absolutely address.
The first error among these is that the class of each item (item = fields + format) must have its own properties that it must manage on its own. But to define the list of properties of each item I have to decide which properties to consider "common" to all items and which to consider "specific" to each individual item.
There are two reflections related to this problem:

  • theoretically there are very few properties common to all items. Among these I only see: hidden, insearchform and reserved. All the others cannot be common to ALL items because, for example, the "pagebreak" item only has these three properties just mentioned;
  • I already accepted this "lack" of properties ACTUALLY common to all items when I chose to create the itemsetup form (the form to setup a new item for the surveypro) from the union of a "item_setupbaseform" and an "itemsetupform".
    The item_setupbaseform has the fields it has and each item has a rule that says what it wants in its form and what it doesn't want to appear. (Each item defines a static vector called insetupform which declares what it wants to appear in the item_setupbaseform and what not. Obviously there is no similar vector for the specific form of each item because, having been created for the single item, it contains only and exclusively whatever you want.)
    I therefore realize that the answer to the question: which properties must be classified as "common" to all items and which, instead, must be classified as "specific" of each individual item is in the list of fields that I included, 10 years ago, in the "item_setupbaseform" and in the "itemsetupform".
    So in order to make the code more homogeneous and self-consistent, I have to start moving all the "common" fields from the tables of each individual item ('surveypro'.$type.'_'.$plugin) to the surveypro_item table.

The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.

Two details:

  1. I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:
    -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;
    -- upgrade your surveypro;
    -- regenerate each usertemplate and each mastertemplate.
  2. obviously the next PR I will make will relate to moving the other "common" properties from the specific tables to the surveypro_item table (and I will create them on top of this one).

@kordan kordan force-pushed the content_among_basics branch 2 times, most recently from d5d0666 to 0566ba4 Compare March 23, 2024 19:38
As part of a work of standardization and modernization of the module aimed at making the code homogeneous and, consequently, easily understandable and modifiable, I realized that the use of PHP 8.2 highlights a significant and very long series of errors that I must absolutely address.
The first error among these is that the class of each item (item = fields + format) must have its own properties that it must manage on its own. But to define the list of properties of each item I have to decide which properties to consider "common" to all items and which to consider "specific" to each individual item.
There are two reflections related to this problem:
- theoretically there are very few properties common to all items. Among these I only see: hidden, insearchform and reserved. All the others cannot be common to ALL items because, for example, the "pagebreak" item only has these three properties just mentioned;
- I already accepted this "lack" of properties ACTUALLY common to all items when I chose to create the itemsetup form (the form to setup a new item for the surveypro) from the union of a "item_setupbaseform" and an "itemsetupform".
The item_setupbaseform has the fields it has and each item has a rule that says what it wants in its form and what it doesn't want to appear. (Each item defines a static vector called insetupform which declares what it wants to appear in the item_setupbaseform and what not. Obviously there is no similar vector for the specific form of each item because, having been created for the single item, it contains only and exclusively whatever you want.)
I therefore realize that the answer to the question: which properties must be classified as "common" to all items and which, instead, must be classified as "specific" of each individual item is in the list of fields that I included, 10 years ago, in the "item_setupbaseform" and in the "itemsetupform".
So in order to make the code more homogeneous and self-consistent, I have to start moving all the "common" fields from the tables of each individual item ('surveypro'.$type.'_'.$plugin) to the surveypro_item table.

The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.

Two details:
1. I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:
- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;
- upgrade your surveypro;
- regenerate each usertemplate and each mastertemplate.
2. obviously the next PR I will make will relate to moving the other "common" properties from the specific tables to the surveypro_item table (and I will create them on top of this one).
@kordan kordan marked this pull request as draft March 23, 2024 23:56
@kordan kordan force-pushed the content_among_basics branch 3 times, most recently from deb770f to 4860219 Compare March 25, 2024 15:21
As part of a work of standardization and modernization of the module aimed at making the code homogeneous and, consequently, easily understandable and modifiable, I realized that the use of PHP 8.2 highlights a significant and very long series of errors that I must absolutely address.
The first error among these is that the class of each item (item = fields + format) must have its own properties that it must manage on its own. But to define the list of properties of each item I have to decide which properties to consider "common" to all items and which to consider "specific" to each individual item.
There are two reflections related to this problem:

    theoretically there are very few properties common to all items. Among these I only see: hidden, insearchform and reserved. All the others cannot be common to ALL items because, for example, the "pagebreak" item only has these three properties just mentioned;
    I already accepted this "lack" of properties ACTUALLY common to all items when I chose to create the itemsetup form (the form to setup a new item for the surveypro) from the union of a "item_setupbaseform" and an "itemsetupform".
    The item_setupbaseform has the fields it has and each item has a rule that says what it wants in its form and what it doesn't want to appear. (Each item defines a static vector called insetupform which declares what it wants to appear in the item_setupbaseform and what not. Obviously there is no similar vector for the specific form of each item because, having been created for the single item, it contains only and exclusively whatever you want.)
    I therefore realize that the answer to the question: which properties must be classified as "common" to all items and which, instead, must be classified as "specific" of each individual item is in the list of fields that I included, 10 years ago, in the "item_setupbaseform" and in the "itemsetupform".
    So in order to make the code more homogeneous and self-consistent, I have to start moving all the "common" fields from the tables of each individual item ('surveypro'.$type.'_'.$plugin) to the surveypro_item table.

The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.

Two details:

    I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:
    -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;
    -- upgrade your surveypro;
    -- regenerate each usertemplate and each mastertemplate.
    obviously the next PR I will make will relate to moving the other "common" properties from the specific tables to the surveypro_item table (and I will create them on top of this one).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant