MODX Community

Developing your own extra

I was following along with this tutorial to develop my first extra, and I have gotten stuck here.
When I access the build file the same way it suggests, I get this error Model directory not found!
So rereading over the example code and putting logs around the place, it seems like the issue is here

$sources = array(
    'model' => $modx->getOption('sfcss.core_path').'model/',
    'schema_file' => $modx->getOption('sfcss.core_path').'model/schema/superFastCSS.mysql.schema.xml'
);

line 9 of the build.schema.php example

I have figured out that the sfcss is the namespace that is supposed to be created. I know it is also referenced inside of the class.php file, but that code hasn’t been called yet.

It doesn’t seem to be mentioned anywhere in the documentation about where this is supposed to be defined. I hope someone can give some insight?

1 Like

I just had a look at the tutorial and I think you’re right. Something there is missing.
Jump ahead to the second part of the tutorial and add the namespace like it shows then come back to this.

Or you could add the static full path to the build script for now.

1 Like

Make sure you created the system setting it refers to (in System > System Settings in the manager), sfcss.core_path and that they’re correct. You would’ve done that in the “Making the Magic Path Settings” section

The namespace is not necessary, but does help keep things organised.

There’s also a newer tutorial about creating components in MODX here. Originally written in Russian and painstakenly translated by Ivan Bochkarev. I’m not sure if it’s 100% complete yet, but from the contents it does look like the part up to generating the model is there. It’s also very thorough, including on setting up a development environment in PHPStorm.

2 Likes

There is also this. Even if you don’t use MyComponent, it might help you understand the process.

1 Like

Oops, completely missed it. I’m blind!
Mark is right :slight_smile: