# Call to a member function beginTransaction() on null

**URL:** <https://community.dreamfactory.com/t/call-to-a-member-function-begintransaction-on-null/4260>\
**Category:** Server-Side Scripting\
**Created:** [January 24, 2018, 10:42am UTC](https://community.dreamfactory.com/t/call-to-a-member-function-begintransaction-on-null/4260 "2018-01-24T10:42:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ollielowson](https://avatars.discourse-cdn.com/v4/letter/o/b9bd4f/32.png) [@ollielowson](https://community.dreamfactory.com/u/ollielowson)\
**Post date:** [January 24, 2018, 10:42am UTC](https://community.dreamfactory.com/t/call-to-a-member-function-begintransaction-on-null/4260/1 "2018-01-24T10:42:46Z")

</div>

Hi,

I am having some trouble deploying a custom API based on a PHP script: the script works once, then on subsequent calls fails with an exception, until I clear the Dreamfactory cache.

The script with problems:

1. Receives a JSON document that refers to several different related tables, in a custom format
2. Parses this JSON to extract the data that we need
3. Generates a resource to submit through an internal API call to Dreamfactory, including related data - using the XX\_by\_XXID notation as per the documentation: [Related Data](https://wiki.dreamfactory.com/DreamFactory/Features/Database/Related_Data)
4. Submits the resource in a transaction, i.e. with rollback=true

So far I have tried:

- Using my script to generate the resource and submitting this manually through the API docs - this works
- Reinstalling Dreamfactory - this seemed to work, but I came in the next day and the issue was back
- Changing from MariaDB to MySQL-5.7 - this made no difference

When I check the MySQL logs, I am seeing no second attempt to submit the request (which would make sense, given that the error implies that the connection has gone away).

I am running out of ideas, has anyone else come across this issue?

Many thanks,

Ollie

---

<div class="post-metadata">

**Author:** ![ollielowson](https://avatars.discourse-cdn.com/v4/letter/o/b9bd4f/32.png) [@ollielowson](https://community.dreamfactory.com/u/ollielowson)\
**Post date:** [January 24, 2018, 2:34pm UTC](https://community.dreamfactory.com/t/call-to-a-member-function-begintransaction-on-null/4260/2 "2018-01-24T14:34:49Z")

</div>

Hi everyone,

I have found a solution (or perhaps just a workaround) to this. See [https://github.com/laravel/framework/pull/22905](https://github.com/laravel/framework/pull/22905)

Hope this helps someone.

Ollie
