yii-joblo / menubuilder

Yii extension: UI for managing (CRUD, arrange nestable) menus/items online
BSD 3-Clause "New" or "Revised" License
8 stars 3 forks source link

And the schema for DB menus #1

Open larry-tx opened 11 years ago

larry-tx commented 11 years ago

Your extension looks great; you have truly done a lot of work on it. Forgive my ignorance. I'm very new to Yii (although I've been a PHP developer for years). I cannot seem to figure out how to use the extension with a database.You have obviously created models to work with database tables, but I can't find a schema for such tables. Of course, I can infer the tables and fields from the model attributes, but it certainly would be helpful to have a schema. In addition, I can find a switch to make it pull data from the database instead of the file system.

Also, I can't seem to find how to save information from your file-based supplied demo files. I've tried making changes and saving them. I get a message saying that the save was successful, but nothing persists if I move elsewhere and come back.

Finally, upon initial install, when you try to run the localhost/menubuilder page, it has a fatal error in that it can't find the select2 extension. I simply copied the extension into the root extensions directory, and it works after that.

yii-joblo commented 11 years ago

Ok, you are right. The path to the select2 component is wrong.

Should be 'ext.menubuilder.extensions.select2.ESelect2' instead of 'ext.select2.ESelect2' in the views:

Switching to MySql:

[php]
'modules'=>array(

'menubuilder'=>array(
            ...
            //'checkInstall'=>false, //default is true
            'dataAdapterClass'=> 'EMBDbAdapter', //'EMBMongoDbAdapter',      
        ),
),

...

'components'=>array(

'db'=>array(
           'connectionString' => 'mysql:host=localhost;dbname=mydatabase',
            'username' => 'root',
            'password' => '',
                        ....
)

If checkInstall is true, it will be checked if the tables 'emb_menu', 'emb_menuitem', 'emb_language' exists in the db, otherwise the schema will be created. See EMBDbAdapter::checkCreateMenuTable, EMBDbAdapter::checkCreateMenuItemsTable. So set 'checkInstall' to false after the first run.

Saving in file-based mode

larry-tx commented 11 years ago

Adding this:

'modules' => array(
    ...
   'menubuilder' => array(
            //'checkInstall' => false, // default is true
            'dataAdapterClass' => 'EMDbAdapter',
        ),
),

produces this error:

include(EMDbAdapter.php): failed to open stream: No such file or directory 

Sorry to be such a pest, but I'm sure you don't want everyone running into these errors.

yii-joblo commented 11 years ago

Sorry, the name of the class is "EMBDbAdapter".

kimuchu commented 10 years ago

I have installed your extension , I have configured the my main file as stated above but it gives the following error

The table "emb_menu" for active record class "EMBDbMenu" cannot be found in the database.

yii-joblo commented 10 years ago

If the modules property checkInstall = true, the install method should be called in EMBAdminController::actionIndex. This should create the emb_menu table in the database.

Pleases debug the code to check what's wrong ...

public function actionIndex()
    {
       ...
        if ($module->checkInstall) <-- debug breakpoint here
        {
            $this->install();  
        }