{"id":16568731,"url":"https://github.com/drupol/adjacencylist","last_synced_at":"2026-04-21T13:32:03.820Z","repository":{"id":139073050,"uuid":"196745597","full_name":"drupol/adjacencylist","owner":"drupol","description":"Doctrine and Adjacency Lists","archived":false,"fork":false,"pushed_at":"2019-07-17T16:40:15.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-05T11:50:00.196Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/drupol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-13T16:54:45.000Z","updated_at":"2019-07-17T16:40:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"25aae4a2-f718-4152-b1d7-aff75e362590","html_url":"https://github.com/drupol/adjacencylist","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/drupol/adjacencylist","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drupol%2Fadjacencylist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drupol%2Fadjacencylist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drupol%2Fadjacencylist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drupol%2Fadjacencylist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drupol","download_url":"https://codeload.github.com/drupol/adjacencylist/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drupol%2Fadjacencylist/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32094377,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T11:25:29.218Z","status":"ssl_error","status_checked_at":"2026-04-21T11:25:28.499Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-10-11T21:11:31.539Z","updated_at":"2026-04-21T13:32:03.791Z","avatar_url":"https://github.com/drupol.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# API Platform / Doctrine / Adjacency list\n\nAn adjacency list is a way to store a tree data structure using a table having\n2 columns.\n\nThis tree containing nodes:\n\n```\nroot\n  node1\n  node2\n    node2.1\n    node2.2\n  node3\n    node3.1\n```\n\nCould be stored in a table as such:\n\n| id      | parent |\n|---------|--------|\n| root    | null   |\n| node1   | root   |\n| node2   | root   |\n| node2.1 | node2  |\n| node2.2 | node2  |\n| node3   | root   |\n| node3.1 | node3  |\n\nThe SQL structure of that table would be:\n\n```sql\nCREATE TABLE adjacency_list (\n  id INT AUTO_INCREMENT NOT NULL,\n  parent_id INT DEFAULT NULL,\n  INDEX IDX_FDE5D6BF727ACA70 (parent_id),\n  PRIMARY KEY(id)\n) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB\n\nALTER TABLE adjacency_list\n  ADD\n    CONSTRAINT FK_FDE5D6BF727ACA70\n    FOREIGN KEY (parent_id)\n    REFERENCES adjacency_list (id)\n```\n\nThen, another table can be created that would contains the metadata of each node.\n\n| id | nodeId  | firstname | lastname |\n|----|---------|-----------|----------|\n| 1  | root    | A         | B        |\n| 2  | node1   | C         | D        |\n| 3  | node2   | E         | F        |\n| 4  | node2.1 | G         | H        |\n| 5  | node2.2 | I         | J        |\n| 6  | node3   | K         | L        |\n| 7  | node3.1 | M         | N        |\n\nThe structure would be:\n\n```sql\nCREATE TABLE adjacency_list_item (\n  id INT AUTO_INCREMENT NOT NULL,\n  nodeId INT DEFAULT NOT NULL,\n  firstname VARCHAR(255) NOT NULL,\n  lastname VARCHAR(255) NOT NULL,\n  UNIQUE INDEX UNIQ_DDADA13E126F525E (nodeId),\n PRIMARY KEY(id)\n) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB\n\nALTER TABLE adjacency_list_item\n ADD\n   CONSTRAINT FK_DDADA13E126F525E\n   FOREIGN KEY (nodeId) \n   REFERENCES adjacency_list (id)\n```\n\n# Issue\n\nFind why we are not able to validate the schema.\n\n* Run: `./bin/console doctrine:schema:validate`\n\n# Usage\n\nIn order to get started with this, do:\n\n* Run: `composer install`\n* Update the `.env` file and set the URL to your database, mysql or mariadb is advised here.\n* Run: `./bin/console doctrine:database:create`\n* Run: `./bin/console doctrine:schema:update --force --complete --dump-sql`\n\nTo generate the fixtures in the database, do:\n\n* Run: `./bin/console hautelook:fixtures:load`\n\n### More informations:\n\nFind the difference between the database schema and the entities:\n\n* Run: \n```shell\nbin/console do:da:dr --force                                                                                                    \nbin/console do:da:cr\nbin/console do:sc:up --force\nbin/console do:sc:val\nbin/console do:sc:up --dump-sql\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrupol%2Fadjacencylist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrupol%2Fadjacencylist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrupol%2Fadjacencylist/lists"}