SOLVED: Extending EXISTING Package with new single_page

Permalink
Hi all!

How can I add a single_page to an existing package, without re-installing the package?

I am extending an existing package to add new functionality. I have created the necessary controllers, classes, pages and single_page, but I can't figure out how to install the single_page as part of the existing package.

I do not want to uninstall or re-install the package, as it has loads of data already and re-istalling it will yield lots of errors.

Any ideas welcome,

Best regards,
-Costa

cnrx
 
Tony replied on at Permalink Reply
Tony
maybe you could put something in the package constructor, that will check if the package is installed, and whether the single page has been installed, and if not, add it.
cnrx replied on at Permalink Reply
cnrx
Good idea, but this will take quite a while, as the controller is quite complex and I would still need to avoid the parent install() method, as this would cause a lot of trouble.

Instead, I was looking for a kind of 'workaround' where I can perhaps add the single page by passing the package object.

However, I don't know how to execute the necessary code. Is there a way to upload a temporary page and execute it only once?

-Costa
cnrx replied on at Permalink Reply
cnrx
hi Tony,

I have resolved it in a simple way:
I edited an existing dashboard page and added the following code:
$pkg = Package::getByID(3);
var_dump($pkg);
Loader::model('single_page');
SinglePage::add('/dashboard/myPackage/comments', $pkg);

I then executed the page and removed the code.

Thanks for replying
-Costa