alice: Column 'ancestor' cannot be null

Hello , I am having problem setting up alice for entities with parent and childrens.

productCategoryParent_{1..3}:
      name: productCategory_parent_<current()>
      createdAt: <datetimeBetween('-5 days', 'now')>
      updatedAt: <datetimeBetween('-5 days', 'now')>

productCategory_{1..30}:
      name: productCategory_<current()>
      parent: '@productCategoryParent_*'
      createdAt: <datetimeBetween('-5 days', 'now')>
      updatedAt: <datetimeBetween('-5 days', 'now')>

When I run the fixture I get SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'ancestor' cannot be null

In my orm.xml file I have this:

<many-to-one field="parent" target-entity="ProductCategory" inversed-by="children">
            <join-column name="parent_id" referenced-column-name="id" nullable="true" />
            <gedmo:tree-parent />
        </many-to-one>
        <one-to-many field="children" target-entity="ProductCategory" mapped-by="parent" />

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@iBasit I’m sorry but I cannot really help without more information. As I said at some point the easiest way to go is to look at the generated objects to see what is wrong and eventually check how the properties are populated( see Populator in 2.x or Hydrator in 3.x)