bigin / ItemManager_2.0

ItemManager (IM) is a simple flat-file framework for GetSimple-CMS that allows you to develop completely customizable PHP applications bundled with GetSimple-CMS.
MIT License
5 stars 3 forks source link

Can't create Item #6

Closed mittus closed 7 years ago

mittus commented 7 years ago

Hello!

I can't use construction: $item = new Item(1); $item->name = 'My item name'; $item->save();

In ItemManager nothing appears :(

List my all plugins: http://prntscr.com/gfb2cc Category: http://prntscr.com/gfb2sy

bigin commented 7 years ago

Everything works as usual here, do you get an error message? Did you know that the "new Item(ID)" should contain an ID of an existing category?

mittus commented 7 years ago

No, I haven't message, when I use this construction, nothing happens. I use id my category (1).

bigin commented 7 years ago

I can't reproduce it, sorry. But ItemManager uses the same API function call to creating its items in admin area.

mittus commented 7 years ago

Than'k you. I will search this problem and write here about this.

bigin commented 7 years ago

Ok, you can check whether your item object created before you save:

$item = new Item(your_cat_id);
$item->name = 'My item name';
Util::preformat($item);
bigin commented 7 years ago

I will close this issue for now until I can reproduce this error

mittus commented 7 years ago

Hello!

I can use this construction only with $imanager = new IManager();

It's work for me:

function test() {
    $imanager = new IManager();
    $item = new Item(1);
    $item->name = 'New Item';
    $item->save();
}
bigin commented 7 years ago

Hmm, I thought you had already done that. Of course, you need to create an ItemManager instance first ;-) Do this:

imanager();
$item = new Item(1);
$item->name = 'New Item';
$item->save();

new IManager() is deprecated

mittus commented 7 years ago

Thank you very much, it's work!!

bigin commented 7 years ago

You are welcome!