Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Modules preparation : move all SQL-logic into the managers #1215

Closed
wants to merge 41 commits into from

3 participants

@kanduvisla

This pull requests moves all the SQL-logic made to tbl_pages, tbl_fields and tbl_sections into their corresponding Managers. I had to add some static functions to the managers to provide the needed functionality on some points, but (nearly) all the logic is now moved.

Some points of attention:

  • There is still some section-SQL-logic left in the FieldManager.
  • Also there is still some pages-SQL-logic left in the navigation datasource.

Don't worry, it's safe

I've worked and merged with the latest integration branch, and no issues have been found. This is not very surprising, since the only thing I've done is moved some logic to the managers and created some new functions in the managers to handle certain logic. In other words: nothing new is created, it's just moving of code.

I'll work further on this code, but know that it's safe to merge this pull request in the integration branch, and please consider to do so. I will continue my work on Storing Sections and Pages as XML and this pull request covers step 2-4 from my roadmap

kanduvisla added some commits
@kanduvisla kanduvisla Merge commit 'ee4a8116c9dd2abd2dfb7b47a956be612ba8876f' into integration 29d0eb3
@kanduvisla kanduvisla Remove tbl_sections-references 6d87ee6
@kanduvisla kanduvisla Replaced tbl_sections-dependencies with function calls to SectionManager 970e6f6
@kanduvisla kanduvisla Replaced tbl_sections-dependencies with static function calls to Sect…
…ionManager
8bdb4e4
@kanduvisla kanduvisla Handle the sections association inside the SectionManager 2928ee8
@kanduvisla kanduvisla added a little todo note f85276c
@kanduvisla kanduvisla moved tbl_fields logic to FieldManager 11c9ffb
@kanduvisla kanduvisla moved tbl_fields logic to FieldManager f407856
@kanduvisla kanduvisla move tbl_fields logic to FieldManager (added fetchSchema()-function) e70a142
@kanduvisla kanduvisla move tbl_fields logic to FieldManager 3251574
@kanduvisla kanduvisla move tbl_fields logic to FieldManager 63e483a
@kanduvisla kanduvisla move tbl_pages-logic to PageManager 83a6b2a
@kanduvisla kanduvisla move tbl_pages logic from FrontendPage to PageManager c164816
@kanduvisla kanduvisla move some tbl_pages logic out of navigation datasource and into PageM…
…anager
6d5dfe4
@kanduvisla kanduvisla Merge commit '721e133eaa1dfe66c30777945d42954fe9e02a08' into Modules 9082a49
@kanduvisla kanduvisla moved tbl_fields-dependency out of content.publish.php to FieldManager 3f722ec
@kanduvisla kanduvisla moved tbl_fields-logic to FieldManager class 8622d09
@kanduvisla kanduvisla empty line? 988984e
@kanduvisla kanduvisla moved tbl_fields-logic out of SectionManager and into FieldManager 4526c3c
@kanduvisla kanduvisla moved tbl_fields logic out of extensionmanager and into the fieldmanager 670261e
@kanduvisla kanduvisla Merge commit 'aad235ded546f5b0df03a99c508eaf50e703363d' into Modules
Conflicts:
	symphony/content/content.publish.php
f5660e8
@kanduvisla kanduvisla restore previously made changes, move tbl_fields-logic to FieldManager 7e5242b
@alpacaaa

Looks great!

@brendo
Owner

All new functions need to be documented to include the @since Symphony 2.3 comment.

I'll review later this weekend. Something I will be looking at it trying to minimise the number of Manager functions that are quite specific and rolling them into more general functions. This will/may require some other code changes, but I think it's far better than having 'x' number of specific methods.

@kanduvisla

@brendo I also tried to use existing manager functions where possible, but some cases where too specific to do so. If you could change some of the code to be more general, that would be great. As for the @since Symphony 2.3-comment: is this something you'll pick up this weekend (along with the code generalization)? Or do I have to add these lines and commit it?

@brendo
Owner

I can add them in as I go :) Yeah, the majority of the new functions will be needed as there's no equivalent or the workaround is horrible.

kanduvisla added some commits
@kanduvisla kanduvisla First steps into storing pages into XML-files 68bb797
@kanduvisla kanduvisla Merge remote-tracking branch 'upstream/integration' into Modules 9f9969d
@kanduvisla kanduvisla Merge remote-tracking branch 'upstream/integration' into Modules-Pages 9700742
@kanduvisla kanduvisla - Created Lookup Module (for lookup tables)
- Adjusted Page Manager to work with Lookup Module (part one)
88bcfbd
@kanduvisla kanduvisla Merge remote-tracking branch 'upstream/integration' into Modules 7946315
@kanduvisla kanduvisla Merge remote-tracking branch 'upstream/integration' into Modules-Pages e0e2f1c
@kanduvisla kanduvisla trying something news here... 0255a88
@kanduvisla kanduvisla Replaced all Database-logic with Lookup-logic 9d476e2
@kanduvisla kanduvisla Replace the database-logic inside the navigation datasource with look…
…up-logic
395a2ed
@kanduvisla kanduvisla Bugfix in edit function 9b13dd0
@kanduvisla kanduvisla Minor changes to resourcemanager to support the lookup table 26cc60e
@kanduvisla kanduvisla Merge branch 'Modules-Pages' into Modules 0f51c9f
@kanduvisla kanduvisla added installation script for lookup tables bfa25f0
@kanduvisla kanduvisla - added check to work with manually created or deleted pages
- bugfix: when no page type was set, Symphony would throw an error
- bugfix: Lookup::save() didn't return the correct ID
- bugfix: When sorting the index, duplicate values got overwritten
4d78033
@kanduvisla kanduvisla Merge remote branch 'upstream/integration' into Modules 62f51d8
@kanduvisla kanduvisla removed addPageTypesToPage()-function and deletePageTypes() since pag…
…e types are no longer stored in a second column in the database, but in one XML-file
4ac380a
@kanduvisla kanduvisla added a simple form of caching to the lookup class 2de6935
@kanduvisla kanduvisla Replaced `PageManager::fetch()`-function to purely use XPath, and no …
…MySQL-converting crap
594b4e4
@kanduvisla kanduvisla Fixed documentation 5e9cfea
@brendo
Owner

Ok I've merged in these commits into 476aecc:

@brendo

This is not a suitable replacement, e70a142 added FieldManager::fetchSchema but it only returns an array of ID's, not basic schema information.

@brendo
Owner

Closing. Field & Section logic will be reviewed in the leadup to 2.5 (focusing on the exciting Pages work for 2.4 first!)

@brendo brendo closed this
@kanduvisla

Wait, what?

But this is only about removing Database-logic to their specific managers! The whole idea is that extension developers use PageManager, SectionManager and FieldManager static functions to get their data instead of directly querying the database! By not providing this functionality in their Managers you risk having extensions who won't work once the Modules-concept starts kicking in!

Please reconsider

@brendo brendo reopened this
@brendo
Owner

Ugh you're right. That's my cue to get some sleep!

@brendo
Owner

Ok have merged in the following FieldManager changes into a2b50f6

  • 3251574 (renamed to isFieldUsed for consistency)
  • e70a142 (logic is now included in an improved FieldManager::fetchFieldIDFromElementName)
  • 63e483a (renamed to fetchFieldsSchema for consistency. This function really can call a couple of places home, for brevity, FieldManager will do)
  • 670261e

Ignored these:

  • 3f722ec (unnecessary, FieldManager::fetchFieldIDFromElementName + FieldManager::fetch does the same job)
  • 8622d09 (not required, FieldManager::fetchFieldIDFromElementName does the job)
  • 4526c3c (not required, loading with FieldManager::fetch works)
  • 11c9ffb (too bespoke, not useful to any extensions)
  • f407856 (unnecessary performance impact, not needed for extensions)

Now can close :)

@brendo brendo closed this
@kanduvisla

On a sidenote:

Make absolutely sure this get announced when releasing 2.3. This way, extension developers can:

  • change their direct database calls to Manager-calls.
  • provide requests for missing Manager-functions for some specific functionality.
@brendo
Owner

Yep this has been added to the Migration Guide (need to flesh out a little further which I'll do when I add the release notes) and when the new API docs are generated we can scrape the 'new to 2.3' functions out to give them more visibility as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 26, 2012
  1. @kanduvisla
  2. @kanduvisla
  3. @kanduvisla
  4. @kanduvisla
  5. @kanduvisla
  6. @kanduvisla

    added a little todo note

    kanduvisla authored
  7. @kanduvisla
  8. @kanduvisla
  9. @kanduvisla
  10. @kanduvisla
  11. @kanduvisla
Commits on Mar 27, 2012
  1. @kanduvisla
  2. @kanduvisla
  3. @kanduvisla
Commits on Mar 28, 2012
  1. @kanduvisla
  2. @kanduvisla
  3. @kanduvisla
  4. @kanduvisla

    empty line?

    kanduvisla authored
  5. @kanduvisla
  6. @kanduvisla
  7. @kanduvisla

    Merge commit 'aad235ded546f5b0df03a99c508eaf50e703363d' into Modules

    kanduvisla authored
    Conflicts:
    	symphony/content/content.publish.php
  8. @kanduvisla
Commits on Mar 29, 2012
  1. @kanduvisla
Commits on Mar 31, 2012
  1. @kanduvisla
  2. @kanduvisla
  3. @kanduvisla

    - Created Lookup Module (for lookup tables)

    kanduvisla authored
    - Adjusted Page Manager to work with Lookup Module (part one)
Commits on Apr 1, 2012
  1. @kanduvisla
  2. @kanduvisla
  3. @kanduvisla
  4. @kanduvisla
  5. @kanduvisla
  6. @kanduvisla

    Bugfix in edit function

    kanduvisla authored
  7. @kanduvisla
  8. @kanduvisla
  9. @kanduvisla
Commits on Apr 2, 2012
  1. @kanduvisla

    - added check to work with manually created or deleted pages

    kanduvisla authored
    - bugfix: when no page type was set, Symphony would throw an error
    - bugfix: Lookup::save() didn't return the correct ID
    - bugfix: When sorting the index, duplicate values got overwritten
Commits on Apr 3, 2012
  1. @kanduvisla
  2. @kanduvisla

    removed addPageTypesToPage()-function and deletePageTypes() since pag…

    kanduvisla authored
    …e types are no longer stored in a second column in the database, but in one XML-file
  3. @kanduvisla
  4. @kanduvisla
  5. @kanduvisla

    Fixed documentation

    kanduvisla authored
Something went wrong with that request. Please try again.