WordPress.org

Ready to get started?Download WordPress

Forums

WP MVC
Is a Model without a db table possible? (2 posts)

  1. davelopware
    Member
    Posted 2 years ago #

    I've got a use case where I'm processing some data and would like a model-view-controller set, but where the model is simple a collection of objects which result from some processing.

    In the more general case, a model might 'back' onto an rss feed, 3rd party JSON api, etc etc etc.

    Has anyone done anything like this with WP MVC yet?

    A quick inspection of mvc_model.php suggests it's pretty db specific.

    My instinct would be to have an abstract base MvcModel (or interface) and a MvcDatabase based implementation derived from it. Maybe MvcModelBase as the abstract class, and MvcModel as the Database backed implementation of it.

    Thoughts / suggestions greatly appreciated

    http://wordpress.org/extend/plugins/wp-mvc/

  2. davelopware
    Member
    Posted 1 year ago #

    In the absence of anyone else looking at this, I've made a start on it. You can find it on my fork of the code on github here:

    https://github.com/damphlett/wp-mvc

    the commit associated with this change is here:

    https://github.com/damphlett/wp-mvc/commit/7ab2e9fa21f30146d43e78a2872c40c3b44d9f9c

    and the commit comment has a simple example of how you can extend MvcModel to implement a model that ISN'T backed onto a database. The example shows the beginning of a model which enumerates the File System (directories and files) for the WordPress installation.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.