{"id":27450133,"url":"https://github.com/p4bgroup/phalcon-nested-sets","last_synced_at":"2025-04-15T09:12:30.815Z","repository":{"id":57034844,"uuid":"223751005","full_name":"P4BGroup/phalcon-nested-sets","owner":"P4BGroup","description":"Nested Set Model implementation for Phalcon Framework","archived":false,"fork":false,"pushed_at":"2020-05-02T07:47:13.000Z","size":3007,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-15T09:12:08.423Z","etag":null,"topics":["behaviour","nested-sets","phalcon","phalcon-framework","tree"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/P4BGroup.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-24T13:45:46.000Z","updated_at":"2020-08-24T08:33:25.000Z","dependencies_parsed_at":"2022-08-24T14:11:13.913Z","dependency_job_id":null,"html_url":"https://github.com/P4BGroup/phalcon-nested-sets","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/P4BGroup%2Fphalcon-nested-sets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/P4BGroup%2Fphalcon-nested-sets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/P4BGroup%2Fphalcon-nested-sets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/P4BGroup%2Fphalcon-nested-sets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/P4BGroup","download_url":"https://codeload.github.com/P4BGroup/phalcon-nested-sets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249040131,"owners_count":21202823,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["behaviour","nested-sets","phalcon","phalcon-framework","tree"],"created_at":"2025-04-15T09:12:29.878Z","updated_at":"2025-04-15T09:12:30.810Z","avatar_url":"https://github.com/P4BGroup.png","language":"PHP","readme":"Nested Set Behaviour\n--- \n\nPhalcon implementation for tree / hierarchy through nested sets implementation.\nIt will calculate edges and depth for a category on creation, update and delete.\n\nMoving \"branches\" is not supported (o sub-node with all it's sub-nodes) and won't be. This tool is meant to \"react\" to changes on a single record and keep the rest of the tree position in place.\n\nprerequisites\n---\nYour DB must have parent, left, right, depth columns. \nExample:\n\n```SQL\nCREATE TABLE `categories` (\n\t`id` INT(11) NOT NULL AUTO_INCREMENT,\n\t`name` CHAR(50) NULL DEFAULT NULL,\n\t`parent_id` INT(11) NULL DEFAULT NULL,\n\t`_left` INT(11) NULL DEFAULT NULL,\n\t`_right` INT(11) NULL DEFAULT NULL,\n\t`_depth` INT(11) NULL DEFAULT NULL,\n\tPRIMARY KEY (`id`)\n);\n```\n\nusage\n---\n\n```php\n\nclass MyModel extends \\Phalcon\\Mvc\\Model {\n    public function initialize() {\n        $this-\u003eaddBehaviour(new \\P4BGroup\\NestedSets\\Behaviour());\n    }\n}\n\n```\n\nreferences\n---\n* https://en.wikipedia.org/wiki/Nested_set_model\n* https://explainextended.com/2009/09/29/adjacency-list-vs-nested-sets-mysql/\n* https://medium.com/@Sumurai8/nested-sets-performant-attribute-calculation-on-collections-10289a30c0ab\n\nusage\n---\nthis behaviour will automatically calculate the edges and depth of each node on save / delete\n\nSimilar implementations on other frameworks\n---\n* https://github.com/etrepat/baum - laravel \n* https://github.com/lazychaser/laravel-nestedset - laravel \n* https://github.com/blt04/doctrine2-nestedset - doctrine\n* https://github.com/bartko-s/stefano-tree - zend / pdo\n* https://github.com/creocoder/yii2-nested-sets - yii\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp4bgroup%2Fphalcon-nested-sets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fp4bgroup%2Fphalcon-nested-sets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp4bgroup%2Fphalcon-nested-sets/lists"}