Deleting an Express Object

Permalink 1 user found helpful
Hi there, I recently created an "Express Object" via the concrete5 dashboard and I get the error
Call to a member function populateDirectChildrenOnly() on null
when I try to open it.

Is there a way to either fix this or better-yet, delete it entirely?

Any help would be appreciated, thank you in advance.

 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi hemipatu,

What version of concrete5 are you using?

Where are you opening the Express object? Is it the Data Objects page?
Dashboard > System & Settings > Express > Data Objects
tiafelicita replied on at Permalink Reply
Hi, thanks for the reply and please accept my apologies for my delayed response.

I am using the following version of concrete:
Core Version - 8.3.2
Version Installed - 8.3.2
Database Version - 20180122213656

When I try accessing it from Dashboard > Express > Express Entry. This error pops up straight away without fail, however when I access it from Dashboard > System & Settings > Data Objects > My data object. There is no issue, until I select "Edit entity" or "View 'myEntry' Entries.
MrKDilkington replied on at Permalink Reply
MrKDilkington
@hemipatu

To get more information, you can temporarily enable full debug errors. Please reply with a screenshot of the full error as an attachment.
Dashboard > System & Settings > Environment > Debug Settings > Error Detail > Show the debug error output
tiafelicita replied on at Permalink Reply 1 Attachment
Hi there, thank you for your help! I hope the attached file is what you're asking for.
MrKDilkington replied on at Permalink Best Answer Reply
MrKDilkington
@hemipatu

You could probably delete the Express data object programmatically. An alternative is preventing the error from occurring so you can delete it from the dashboard interface.

This is the section of code that is causing the error:
https://github.com/concrete5/concrete5/blob/develop/concrete/src/Pag...

The code within the else condition can be wrapped in an if check to prevent the error.
concrete\src\Page\Controller\DashboardExpressEntriesPageController.php
- find this code
} else {
    $parent->populateDirectChildrenOnly();
    $this->set('nodes', $parent->getChildNodes());
    $this->render('/dashboard/express/entries/folder', false);
}

- change the code to this
} else {
    if ($parent) {
        $parent->populateDirectChildrenOnly();
        $this->set('nodes', $parent->getChildNodes());
        $this->render('/dashboard/express/entries/folder', false);
    }
}

Before making any changes, please make a full site backup (files and database) first. After you delete the data object, you can remove the changes.
tiafelicita replied on at Permalink Reply 1 Attachment
Hi there MrKDilkington, thank you for continuing to help me. I have done you suggested with the edit to the .php which does fix an issue when accessing dashboard>Express>Entry. However I cannot delete it from here, rather I have found out that I have to use dashboard>system&settings>data-objects>object>edit-entity (where accessing edit-entity) throws an exception different to the last.

"Call to a member function getTreeNodeID() on null"


I would attempt to programmatically delete this but I have no idea how to use it and I fear I will completely destroy things or make them worse. Since this is a different error message I have attached an image of the debug that comes up.

- Thanks again.
MrKDilkington replied on at Permalink Reply
MrKDilkington
@hemipatu

You can try adding a ternary operator to prevent the error.
concrete\single_pages\dashboard\system\express\entities\edit.php
- find this code
<input type="hidden" name="entity_results_node_id" value="<?=$folder->getTreeNodeID()?>">

- change the code to this
<input type="hidden" name="entity_results_node_id" value="<?= $folder ? $folder->getTreeNodeID() : ''; ?>">
tiafelicita replied on at Permalink Reply
I am so sorry for the late reply, I feel so rude! - Please accept my apologies.

I have used the above code that you provided and it worked perfectly! Thank you very much for your help and of course patience.
AndrewPaul replied on at Permalink Reply
I've been having the same problem with version 8.1.0.

The fixes suggested by MrKDilkington have worked inasmuch as they've let me get to the delete button, but when I try to delete it, I get the following database error -

An unexpected error occurred.
An exception occurred while executing 'DELETE FROM ExpressEntities WHERE id = ?' with params ["cfc5801f-2b5f-11e8-be7a-0cc47a86337b"]: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`fleetser_conc2`.`ExpressEntityEntries`, CONSTRAINT `FK_B8AE3531AFC87D03` FOREIGN KEY (`exEntryEntityID`) REFERENCES `ExpressEntities` (`id`))

I'm very new to Concrete5 and I don't know whether it's safe to just manually delete the entry from the db, so I thought I ought to check here before I went ahead with poking around in there. Any advice will be gratefully received. Thanks.