MODX 3.0.0 Language string not found: "visibility"

Summary

After a fresh install of 3.0.0 (which is going pretty well) I keep getting the log message:
[2022-04-07 22:22:10] (DEBUG @ … /core/src/Revolution/modLexicon.php : 526) Language string not found: “visibility”

Step to reproduce

No idea.

Environment

I have set my language to ‘en’ which shows when I add extra debugging to the process() function at modLexicon.php : 521. And if it wasn’t set then that routine would use ‘en’ anyway.
I have renamed the connectors and the manager folders.
I don’t have any extras installed yet.

Any ideas?

This language string should exist:

Maybe try clearing the cache.

To you see any output if you put the lexicon tag [[%visibility]] in your content?

Your log_level setting is set to show debug messages; while it’s weird it’s not seeing an existing key, debug messages are not meant to indicate a problem per se.

Thanks, yes the string does exist in that file at line 242.
When I add [[%visibility]] it produces ‘Visibility’.
And I’m worried I might wear my cache out I’ve emptied it so many times :slight_smile:

I have a lot more problems that I need to work out. I’m struggling with creating my model classes from my hand coded schema. But that’s a different topic.

Thanks Mark.
What’s even more weird is that when I add [[%visibility]] it shows the value of the string ‘Visibility’ yet I still get those messages for the same page.

I have no idea why it’s looking up the language string for visibility, I don’t knowingly ask for that in my content or code.

This is not so serious, and I know you guys are super busy, it’s only a debug message and I can live with it for now

Fwiw, I think that’s part of the right click menu in the files tab.

Maybe the extra ExtraBuilder can help you with that.

https://modx.com/extras/package/extrabuilder

That didn’t work for me.
I tried it by importing my schema, it showed the tables (albeit without default values), but when I tried to create the class files"Error, Validate ‘bootstrap.php’: Class still does not exist after autoloader registration:". I had changed the schema baseClass to “xPDO\Om\xPDOObject” and the version to 3.0.

Unfortunately ExtraBuilder is poorly documented and the error message didn’t explain why it failed.

I already have my schema and DB tables, all I need is the classes.

I copied my model classes from my 2.8.3 installation to the 3.0.0 one (with the map files) and everything seems to work. Although that’s probably not ideal.

I had previously searched around for ways to create the classes from the schema, like the one at Reverse Engineer from Database - Generating the Model | MODX Documentation but they all seem to be unable to find XPDO, I guess it has moved since 2.x.

Yes, this doesn’t work anymore:

$xpdo_path = strtr(MODX_CORE_PATH . 'xpdo/xpdo.class.php', '\\', '/');
include_once ( $xpdo_path );
...
$xpdo = new xPDO("mysql:host=$database_server;dbname=$dbase", $database_user, $database_password, $table_prefix);

MODX3 now uses namespaces and autoloader.
You probably have to change it to

require_once MODX_CORE_PATH . "vendor/autoload.php";
...
$xpdo = new xPDO\xPDO("mysql:host=$database_server;dbname=$dbase", $database_user, $database_password, $table_prefix);

Thank you halftrainedharry for helping.
I’ve decided to give up on xPDO and use PDO instead for my custom tables, it has decent documentation and is stable.

I had previously searched around for ways to create the classes from the schema, like the one at Reverse Engineer from Database - Generating the Model | MODX Documentation but they all seem to be unable to find XPDO, I guess it has moved since 2.x.

If you’re looking to build the xPDO model classes from the schema, then you’d need a build schema script. Rather than reverse-engineering from the database, that is.

It might be helpful to have a look at the Articles build schema script as it’s just been refactored for MODX 3.0 (and thus xPDO 3 too).

Here’s the build schema script for Articles on MODX 2.x:

And here’s the one for MODX 3.x:

There is also this “Using Custom Database Tables” tutorial in the documentation, that has recently been updated for MODX3 and contains a simple example of a schema and a built script.

1 Like

Fantastic! I wasn’t aware of that.

Murray,
That looks good, thank you. Unlike Articles I don’t have a pressing need to make the move to 3.0.
I’m switching my custom tables from xPDO to PDO, and moving my tables into a database separate from MODX. I’m not creating an extra so I don’t need to use xPDO.