8.4.2 Column 'cParentID' cannot be null
Permalink
I'm trying to install a page within my package (it used to get installed without problem), but after playing with multilingual something got broken. So I reverted back to a single locale, cleaned up as much as possible, but now when I install my package, I get the following error:
Doctrine \ DBAL \ Exception \ NotNullConstraintViolationException
An exception occurred while executing 'insert into Pages (cID, siteTreeID, ptID, cParentID, uID, cInheritPermissionsFrom, cOverrideTemplatePermissions, cInheritPermissionsFromCID, cDisplayOrder, pkgID, cIsActive, cIsDraft) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["678", null, "5", null, "1", "TEMPLATE", null, 170, 0, 19, 1, 0]: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'cParentID' cannot be null
What could be the problem? The package code has not changed.
If it says the cParentID = null, this could be after multiple deletions and changes in the home page and locales. Should I assign the home page an id? On the other hand that's not a page, it's just a site root view.
Doctrine \ DBAL \ Exception \ NotNullConstraintViolationException
An exception occurred while executing 'insert into Pages (cID, siteTreeID, ptID, cParentID, uID, cInheritPermissionsFrom, cOverrideTemplatePermissions, cInheritPermissionsFromCID, cDisplayOrder, pkgID, cIsActive, cIsDraft) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["678", null, "5", null, "1", "TEMPLATE", null, 170, 0, 19, 1, 0]: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'cParentID' cannot be null
What could be the problem? The package code has not changed.
If it says the cParentID = null, this could be after multiple deletions and changes in the home page and locales. Should I assign the home page an id? On the other hand that's not a page, it's just a site root view.
What code do you use to add the page? You always need a parent page. The home page is the top level page. It has 1 as primary key but I think there's also a constant that you can use that refers to its primary key. When adding the page; specify this id as cParentId.
I know that. But as I said, after trying to reverse the multilingual setup, the home page id was no longer 1. I was wondering if it was possible to reassign it its previous id.
Anyway, I couldn't find how, so I just reinstall the whole c5.
Is there any way to revert the multilingual setup without breaking site?
Anyway, I couldn't find how, so I just reinstall the whole c5.
Is there any way to revert the multilingual setup without breaking site?
Ah, okay, I misunderstood. To be honest; I had a lot of problems with this multilingual package back at my first job when we did a lot of Concrete websites up to the point that we made database backups before installing it. Simular things you describe. That's a while ago though and not sure how much it has improved
Sounds like something is broken here as well and that's hard to fix. Did you empty the trash can in your sitemap? That could possibly help. Pages in the trash are still in the database and if the script is buggy this might contribute to the bug.
But if it's not to much work I'd probably just reinstall. It's hard to say and judge from here. Maybe Mlocati can help you; he wrote it.
Sounds like something is broken here as well and that's hard to fix. Did you empty the trash can in your sitemap? That could possibly help. Pages in the trash are still in the database and if the script is buggy this might contribute to the bug.
But if it's not to much work I'd probably just reinstall. It's hard to say and judge from here. Maybe Mlocati can help you; he wrote it.
A lot in late, but in my situation, Concrete8.5.2 updated from old version, maybe 5.7, solution was to set "siteTreeID" of my default language from "SiteLocales" table, to "Pages" table, column "siteTreeID", where "cFilename" column is "/!drafts/view.php"
After doing that, if you have fixed correctly, following query should return an id, mine was 129
select p.cID from PagePaths pp inner join Pages p on pp.cID = p.cID inner join SiteLocales sl on p.siteTreeID = sl.siteTreeID where cPath = '/!drafts' and sl.siteID = 1
After doing that, if you have fixed correctly, following query should return an id, mine was 129
select p.cID from PagePaths pp inner join Pages p on pp.cID = p.cID inner join SiteLocales sl on p.siteTreeID = sl.siteTreeID where cPath = '/!drafts' and sl.siteID = 1