Deleting an attribute key was throwing a sql foreign key constraint error

Permalink Browser Info Environment
On 8.2.1, i tried deleting a Page Selector Attribute that I had created and every time it threw errors due to a foreign key constraint violation. I ended up updating the deleteKey() method so that it called parent::deleteKey() at the end and that seemed to clear up the issue.

public function deleteKey() {
    $db = Loader::db();
    $arr = $this->attributeKey->getAttributeValueIDList();
    foreach($arr as $id) {
        $db->Execute('delete from atPageSelector where avID = ?', array($id));
    }
    // added this line
    parent::deleteKey();
}


Just wanted to post here in case anyone else ran into this

Type: Discussion
Status: In Progress
bbeng89
View Replies:
Mnkras replied on at Permalink Reply
Mnkras
Feel free to open a pull request:https://github.com/Mnkras/page_selector_attribute...

(5.7 branch)

Thanks!
mlocati replied on at Permalink Reply
mlocati
bbeng89 replied on at Permalink Reply
bbeng89
I actually had made a pull request right after posting this issue -https://github.com/Mnkras/page_selector_attribute/pull/4...

Guess I should have left a comment about it.
mlocati replied on at Permalink Reply
mlocati
Sorry, I didn't check the other pull request contents (your pull request has the "5.7" title, which is not very self-explanatory...)

concrete5 Environment Information

c5 v8.2.1
page selector attribute v2.0.0

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.