{"id":31695035,"url":"https://github.com/angelxmoreno/cakephp-linked-entities","last_synced_at":"2026-07-30T17:31:50.345Z","repository":{"id":62485956,"uuid":"146388957","full_name":"angelxmoreno/cakephp-linked-entities","owner":"angelxmoreno","description":"A CakePHP 3.x Plugin for associating a User Entity to any Entity via a polymorphic model","archived":false,"fork":false,"pushed_at":"2018-09-04T11:10:20.000Z","size":47,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-08T16:49:27.149Z","etag":null,"topics":["cakephp-plugin","cakephp3","php","polymorphism"],"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/angelxmoreno.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}},"created_at":"2018-08-28T03:49:51.000Z","updated_at":"2018-09-04T11:09:49.000Z","dependencies_parsed_at":"2022-11-02T10:00:52.472Z","dependency_job_id":null,"html_url":"https://github.com/angelxmoreno/cakephp-linked-entities","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/angelxmoreno/cakephp-linked-entities","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angelxmoreno%2Fcakephp-linked-entities","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angelxmoreno%2Fcakephp-linked-entities/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angelxmoreno%2Fcakephp-linked-entities/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angelxmoreno%2Fcakephp-linked-entities/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/angelxmoreno","download_url":"https://codeload.github.com/angelxmoreno/cakephp-linked-entities/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angelxmoreno%2Fcakephp-linked-entities/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":36086552,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-30T02:00:05.956Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cakephp-plugin","cakephp3","php","polymorphism"],"created_at":"2025-10-08T16:44:21.781Z","updated_at":"2026-07-30T17:31:50.316Z","avatar_url":"https://github.com/angelxmoreno.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LinkedEntities plugin for CakePHP 3.x\n[![Build Status](https://travis-ci.com/angelxmoreno/cakephp-linked-entities.svg?branch=master)](https://travis-ci.com/angelxmoreno/cakephp-linked-entities)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d4ed026cc47d49619f6905775da67ef6)](https://www.codacy.com/app/angelxmoreno/cakephp-linked-entities?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=angelxmoreno/cakephp-linked-entities\u0026amp;utm_campaign=Badge_Grade)\n[![Maintainability](https://api.codeclimate.com/v1/badges/ce5001ca6c6d9eddaff1/maintainability)](https://codeclimate.com/github/angelxmoreno/cakephp-linked-entities/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/ce5001ca6c6d9eddaff1/test_coverage)](https://codeclimate.com/github/angelxmoreno/cakephp-linked-entities/test_coverage)\n[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.txt)\n[![Minimum CakePHP Version](https://img.shields.io/badge/CakePHP-3.x-red.svg)](https://cakephp.com/)\n[![Minimum PHP Version](http://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg)](https://php.net/)\n\nLinkedEntities allows the ability to associate your User Entities with any other Entities ( including self referencing )\nby a category type. It adds shortcut functions to your User Table for ease of use.   \n\n## Features\n- Ability to define User-to-Entity relationship via a polymorphic table\n- Define relationship by category\n- Automatic relationship of Entity-to-User\n- Shortcut methods based on relationship name\n\n## Examples\n```php\n$this-\u003eUsers-\u003eaddStarredProject($user, $project);\n$this-\u003eUsers-\u003eremoveFollowedUser($user, $otherUser);\n```\n\n## Requirements\n- CakePHP 3.x\n- PHP \u003e=5.6\n\n## Installation\n\nYou can install this plugin into your CakePHP application using [composer](http://getcomposer.org).\n\nThe recommended way to install composer packages is:\n\n```sh\ncomposer require angelxmoreno/cakephp-linked-entities\n```\nNext you need to [load the plugin](http://book.cakephp.org/3.0/en/plugins.html#loading-a-plugin) by adding the following to your `config/bootstrap.php` file:\n```php\n// config/bootstrap.php\nPlugin::load('LinkedEntities', ['bootstrap' =\u003e true]);\n```\n\nFinally, create the required tables using `cakephp/migrations`:\n```bash\nbin/cake migrations migrate -p LinkedEntities\n```\n\nOr import the sql schema found in `config/schema`.\n\n## Setup\n1. In your `config/app.php` define a new config key called `LinkedEntities` ( see [configuration](#configuration) )\n2. In your UsersTable add the `LinkedEntities.LinkableEntityUser` behavior like so:\n```php\n$this-\u003eaddBehavior('LinkedEntities.LinkableEntityUser');\n```\n3. Optionally add the `LinkedEntities.LinkableEntity` behavior to the corresponding Table classes defined in your config. i.e:\n```php\n$this-\u003eaddBehavior('LinkedEntities.LinkableEntity');\n```\n\n## Configuration\nSample configuration:\n```php\n// config/app.php\n'LinkedEntities' =\u003e [\n    'UserModel' =\u003e 'Users',\n    'link_types' =\u003e [\n        'star' =\u003e 1,\n        'follow' =\u003e 2,\n    ],\n    'links' =\u003e [\n        'StarredProjects' =\u003e [\n            'name' =\u003e 'UserStars',\n            'className' =\u003e 'Projects',\n            'linkType' =\u003e 1\n        ],\n        'FollowedProjects' =\u003e [\n            'name' =\u003e 'Followers',\n            'className' =\u003e 'Projects',\n            'linkType' =\u003e 2\n        ],\n        'FollowedUsers' =\u003e [\n            'name' =\u003e 'Followers',\n            'className' =\u003e 'Users',\n            'linkType' =\u003e 2\n        ]\n    ]\n]\n```\nWith the configuration above ( after adding the behavior ) you will have 6 new methods available to your UsersTable:\n1. $this-\u003eUsers-\u003eaddStarredProjects($user, $project);\n2. $this-\u003eUsers-\u003eremoveStarredProjects($user, $project);\n3. $this-\u003eUsers-\u003eaddFollowedProjects($user, $project);\n4. $this-\u003eUsers-\u003eremoveFollowedProjects($user, $project);\n5. $this-\u003eUsers-\u003eaddFollowedUsers($user, $otherUser);\n6. $this-\u003eUsers-\u003eremoveFollowedUsers($user, otherUser);\n\n#### UserModel parameter\nA string defining the plugin.name of your UsersTable ( defaults to `Users` )\n\n#### link_types\nAn array as a int =\u003e string ( this saves the int provided under the table column `type` )\n\n#### links\nAn array as relationship name =\u003e settings\nSettings have the following keys\n - name: The name of the relationship from the perspective of the linked entity ( the reverse relationship name )\n - className: The name of the table to associate the user to\n - linkType: the int value corresponding to one of the defined `link_types`\n\n## Reporting Issues\nIf you have a problem with the plugin please open an issue on [GitHub](https://github.com/angelxmoreno/cakephp-linked-entities/issues).\n\n## License\nThis plugin is offered under an [MIT license](https://opensource.org/licenses/mit-license.php).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangelxmoreno%2Fcakephp-linked-entities","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangelxmoreno%2Fcakephp-linked-entities","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangelxmoreno%2Fcakephp-linked-entities/lists"}