简体   繁体   中英

I am getting: “Non-static method Inflector::singularize() should not be called statically” when running MySQLConnector.php

I am trying to setup OData connection to MySQL database .. when I run the MySQLConnector.php , I am getting the above error.. can someone please direct me towards a solution. The statement that gives the error is:

public function getEntityTypeName($entity)
{
    return \Inflector::singularize($entity);
}

Following is the code in Inflector.php:

function singularize($word) {
            $_this =& Inflector::getInstance();

            if (isset($_this->_singularized[$word])) {
                    return $_this->_singularized[$word];
            }

Please let me know if you would need any further information. Thanks in advance.

The short answer is: you need to update both of them. It looks like you have an older Inflector which is relying on deprecated PHP behaviour, and it's likely that your MySQLConnector.php is also old. If you don't update, you'll likely hit further problems.

In this case, PHP is complaining that you're using a static call to a method which is missing the "static" keyword. It's very likely that this message is a warning not an error, so it probably isn't causing whatever end problem you're experiencing. If you really want to address this message, you can just write static public function singularize($word) { instead, but like I said you will have more problems.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM