Questions tagged [Nested set] (40)

1
answer

Why can break a tree in Nested Sets?

Hello In a project on yii2 connected https://github.com/creocoder/yii2-nested-sets for the table users, the site implemented a referral program. In addition to the basic fields of lft, rgt, depth, and tree added parent_id field. When you bind or update the user executes a method prepandTo() to move the user under another us...
Rosalee30 asked April 7th 20 at 11:21
2
answers

How to correctly update the information in the table with nested sets?

Problem - lost the numbers in some entries in right and left fields. Information about the hierarchy is (parent_id field), and it is correct. How to convert right and left for the whole tree?
Mckenna asked April 4th 20 at 00:45
1
answer

In eloquent to get all unique associated attributes, and its own descendants in a hierarchical model NestedSet?

Good afternoon. There are 2 models: Service (name, parent_id) + binding of lazychaser/laravel-nestedsetclass Service extends Model { use NodeTrait; protected $table = 'services'; public function parent() { return $this->'s belongsto(Service::class, 'parent_id'); } public function attributes() { return $this->b...
Margarette_Volkman asked April 3rd 20 at 18:09
0
answer

How to check the path in the nested sets?

Nested sets is the category tree, which contains slug it looks like this:(it's slug) - one - - two - - - three - - three - two Ie the url at different levels of nesting can be repeated, maybe the path is still different Can't figure out how to check whether the path to the correct category? /one/two/three How to get the thr...
daniela50 asked April 3rd 20 at 17:47
0
answer

Nested set, set of root categories?

Colleagues, the third day the sounds of the Nested set. Use "gedmo/doctrine-extensions": "2.4.*" Plan to create multiple root categories. This is the task. Missed a nice feature. If the roots begin to move, for example 1 to put the root element in another root. Then the element that was placed in a different root element, s...
Heaven_Blanda asked March 31st 20 at 21:58
2
answers

Nested tree removal, how to recalculate lft, rgt?

Colleagues, good evening! Delete the entire thread. So/** * @param $node * @return void */ public function removeTree(Service $node) { $this->createQueryBuilder("s") ->delete() ->where("s.lft = :lft")->setParameter("lft", $node->getLft()) ->andWhere("s.rgt = :rgt")->setParameter("rgt", $node->ge...
Jeffrey_Franec asked March 31st 20 at 21:13
2
answers

If Nestedset on big data?

Colleagues, good evening! Anyone have experience with the model store attachments, Nestedset? I have a TK problem. 5, 000, 000 organizations. Each organization has its services. Services are grouped. Example: --------------------------------- Car service (group) ---Oil change ---Diagnostics ---Brake pad replacement Took a l...
clare_Wel asked March 31st 20 at 21:02
2
answers

How to display category tree in Django?

There is a model class Category(models.Model): parent = models.ForeignKey('self', null=True, blank=True, on_delete=models.CASCADE, related_name='children') name = models.CharField(max_length=50) You need to build and display the tree in the pattern! Need to do without django-mptt and other modules Tell me how to do it and...
mafalda42 asked March 30th 20 at 00:58
1
answer

How to delete from nested sets node and child elements are put under his parent?

There was a problem in a nested sets in Joomla to remove the nodes, but leave the "descendants" so that they become under the "parent" of the node to delete. The standard delete method deletes the node, and descendants. In the Joomla table structure is defined with fields:id (primary key) parent_id lft rgt level More specif...
erika.Harris asked March 29th 20 at 19:48
0
answer

How to build a large tree which changes frequently?

Good afternoon, connoisseurs. In General, the question is: There is a large tree which changes location once a month. Now everything is implemented according to the model of Nested set, because it is very easy to pull the entire tree (and do it often) without using recursion. But if you want to get just a tree - it's simple...
Kay81 asked March 17th 20 at 12:37