Giter VIP home page Giter VIP logo

wp-orm's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wp-orm's Issues

PHP parsing error

Hello, i got PHP error

Parse error: syntax error, unexpected '[' in \wp-orm\lib\BaseModel.php on line 155

I use PHP 5.3 version.

where_any queries failing

The construction of the OR clause for where_any is trimming one too many characters, thereby rendering the query invalid.

Query.php, line 477:

$where = substr($where, 0, -5) . ')';

should be

$where = substr($where, 0, -4) . ')';

Happy to submit a pull request.

Undefined type 'AbstractClass' in BaseModel.php

} elseif ($value instanceof AbstractClass) {

I think this line should be } elseif ($value instanceof BaseModel) { because you want to call primary_key() as the flattened value in case a property is a type of object that is a subclass of BaseModel, and also because AbstractClass is undefined.

Also @brandonwamboldt, I saw this code being used in a plugin called uListing from a theme I purchased recently from StylemixThemes. Thought you should know.

Add __toString() method to Query class

Turning the query into a string would allow us to modify the query as is, and potentially modify the resultset.

Another option would be to allow us to add before/after filters to the query itself, that way we can just define methods to modify the actual query process.

abstract static function is deprecated php 5.2 or higher

get_table() and get_searchable_fields() is abstract static function. but it is deprecated php 5.2 or higher. I can see error message on wordpress admin console, when debug mode is on.
I try to fix it and modified BaseModel.php, Comment.php, User.php, Post.php as follows.

remove get_table() and get_searchable_fields() to BaseModelInterface,

interface BaseModelInterface {
    /**
     * Overwrite this in your concrete class. Returns the table name used to
     * store models of this class.
     *
     * @return string
     */
    public static function get_table();

    /**
     * Get an array of fields to search during a search query.
     *
     * @return array
     */
    public static function get_searchable_fields();  
}

and add "use WordPress\ORM\BaseModelInterface;" at heads of "Comment.php, User.php, Post.php". I also add "implements BaseModelInteface" to Comment, User, Post class definition as well.

I'm github/php newbie so just post solution here. I don't want break your module. Sorry for my bad English too.

ListTables

How do we make our own tables on the backend using your class? All the other functionality/code is adequately documented, except this. In fact, I didn't even notice this folder (admin) until now. Could you provide some documentation and/or add it to the README?

Thanks for sharing your code, by the way. As a Wordpress developer myself, I'd like to make wp-orm part of my toolbox. It just needs a few more features and it'll be golden.

Perform a Query by Custom Fields

I've just found this plugin and it looks really interesting, but it's not clear for me how to query Posts by some Custom Fields values.

For example, let's say I have a Custom Post Type "Exhibition" and I added 2 custom fields "start_datetime" and "end_datetime" (I added those using Advanced Custom Fields if that matters)

So, as an example, can you tell roughly how would look the query to get all the current Exhibitions?
(i.e., Exhibitions with "start_datetime" < now and "end_datetime" > now)

Table Relationships

All the examples are related to a simple table. What about tables with relationships.

E.g. An Organisation has many employees: So when I create a Organisation object at design time I will also have a array of employee set in the organisation object. Thus composing the employee object with the organisation object.

After doing that if I save organisation can i be assured that I will have a record in the organisation table and 1 or many employees in the employee table and their foreign keys set.

Please let me know.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.