gabordemooij / redbean

ORM layer that creates models, config and database on the fly
https://www.redbeanphp.com
2.3k stars 280 forks source link

tableExists($table) is deprecated - suggests typeExists which does not exist #906

Closed Jemt closed 1 year ago

Jemt commented 1 year ago

Hi.

image

See attached image above. Notice how tableExists($table) has been marked as deprecated. But the suggested alternative does not exist. Proof:

$ pwd
/Users/jemt/www/XXXXXXXX/Server/vendor/gabordemooij/redbean
$ grep -i typeexists -R *
RedBeanPHP/OODB.php:     * @deprecated Use AQueryWriter::typeExists() instead.
RedBeanPHP/Repository.php:       * @deprecated Use AQueryWriter::typeExists() instead.

There is no actual implementation. Am I missing something here?

gabordemooij commented 1 year ago

No, your not missing anything, very good catch, thanks for reporting. This is bug in the source code documentation. The warning was issued after a debate whether RedBean tables should be referred to as types instead of tables. It was just a semantic discussion (and probably we wanted to reduce the number of lines of code). However, as the project evolved this discussion became less relevant and we just decided to keep things the way they are since everyone using RedBeanPHP already knows that bean types just map to tables and hiding that fact (like it was the fashion in those days, 2013) seemed silly. We just forgot to remove the warning I guess. I removed the warning from the source. The method is even fully tested in the unit tests. Also from 2012 on backward compatibility has become a major issue for RedBeanPHP, before that date we had frequent API breaks but since then, the user base has grown so much that every API breakage led to a storm of e-mails, so since then we adjusted our strategy to not make unnecessary changes.

Jemt commented 1 year ago

Cool - I'm glad backward compatibility is a priority. Stability and predictability is key. Thank you :-)