brandonwamboldt / wp-orm

[Unmaintained] Light weight ORM for WordPress
MIT License
176 stars 35 forks source link

abstract static function is deprecated php 5.2 or higher #5

Closed wipe3out closed 10 years ago

wipe3out commented 10 years ago

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.

brandonwamboldt commented 10 years ago

Fixed in 453c5bb08791b32c40833314714fd78383ff384f, thanks!