Ticket #1126 (closed defect: fixed)

Opened 13 months ago

Last modified 10 months ago

createRoot() should use the $model->id instead of a straight MAX()

Reported by: slickrick Owned by: romanb
Priority: minor Milestone:
Component: NestedSet Version: 1.0.0
Severity: Keywords:
Cc: Has Test: no
Status: Pending Core Response Has Patch: no

Description

When you call $tree->createRoot($model), it uses MAX() to find the next root_id. This can causes issues when you have an autoincrement table because the id and root_id end up not being the same.

Instead, Doctrine should look for the $model->id to use as the new root_id. If it's not persistant, Doctrine should save the $model and then use the id. This will save a lot of headache down the road when trying to get the actual root node without multiple queries.

Change History

Changed 12 months ago by jwage

Test case?

Changed 12 months ago by anonymous

  • milestone 0.11.3 deleted

Milestone 0.11.3 deleted

Changed 12 months ago by romanb

  • milestone changed from 0.11.1 to 1.0.0-BETA1

Changed 12 months ago by romanb

  • status changed from new to assigned

Changed 11 months ago by jwage

  • version changed from 0.11 to 1.0
  • milestone changed from Unknown to 1.0.0-RC1

Changed 11 months ago by romanb

  • status changed from assigned to closed
  • resolution set to fixed

(In [4759]) Fixed #1126. Fixed #1165.

Changed 10 months ago by anonymous

  • milestone New deleted

Milestone New deleted

Note: See TracTickets for help on using tickets.