mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #43249
[Bug 1700997] Re: View::create() throws an error if a layout has to be created on the fly
Hi Kristina and Cecilia,
Thanks for your comments on this issue. My code flow is an edge case
apparently.
Kristina, we use an in-house webapp called SelfPad which exports content
to Mahara. You may have heard of it from some of my colleagues from
unil.ch or unige.ch. We are currently in the process of making it
available to the public, at which point you will be personally notified.
Cecilia, thanks for the precise explanation. We are indeed trying to
create a new view and a new layout at the same time. I understand now
this is not the way Mahara is supposed to work and will modify our code
the way you suggested to avoid relying on a Mahara core hack.
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1700997
Title:
View::create() throws an error if a layout has to be created on the
fly
Status in Mahara:
New
Bug description:
We have an external app that creates Views in Mahara. While creating
Views it creates the corresponding layout if needed. However, an error
was alwasys thrown at lib/view.php:334 when calling
ensure_record_exists('view_rows_columns', $vrc, $vrc);. As the $vrc
record is created, the DB insert fails because $vrc->view is null, as
the view is not (yet) created.
The attached patch fixes this by ensuring the view is saved in the DB
(and thus haves an ID) before attempting to create the $vrc object.
Mahara version : 17.04.2
OS : GNU/Linux Debian 8.8
DB : MySQL 5.5
PHP : 5.6
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1700997/+subscriptions
References