{"id":24650748,"url":"https://github.com/tangoman75/repositoryhelper","last_synced_at":"2025-10-07T10:30:24.800Z","repository":{"id":57065002,"uuid":"100729543","full_name":"TangoMan75/RepositoryHelper","owner":"TangoMan75","description":"TangoMan Repository Helper provides trait with useful methods for your repositories","archived":false,"fork":false,"pushed_at":"2018-04-08T21:32:03.000Z","size":131,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-01T08:23:13.689Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/TangoMan75.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-08-18T16:11:47.000Z","updated_at":"2024-05-22T07:49:32.000Z","dependencies_parsed_at":"2022-08-24T14:01:23.786Z","dependency_job_id":null,"html_url":"https://github.com/TangoMan75/RepositoryHelper","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TangoMan75%2FRepositoryHelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TangoMan75%2FRepositoryHelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TangoMan75%2FRepositoryHelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TangoMan75%2FRepositoryHelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TangoMan75","download_url":"https://codeload.github.com/TangoMan75/RepositoryHelper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235614251,"owners_count":19018405,"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":[],"created_at":"2025-01-25T18:16:35.025Z","updated_at":"2025-10-07T10:30:19.484Z","avatar_url":"https://github.com/TangoMan75.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"TangoMan Repository Helper\n==========================\n\n**TangoMan Repository Helper** provides trait with useful functions for your repositories.\n\nInstallation\n============\n\nStep 1: Download the Bundle\n---------------------------\n\nOpen a command console, enter your project directory and execute the\nfollowing command to download the latest stable version of this bundle:\n\n```bash\n$ composer require tangoman/repository-helper\n```\n\nThis command requires you to have Composer installed globally, as explained\nin the [installation chapter](https://getcomposer.org/doc/00-intro.md)\nof the Composer documentation.\n\nUsage\n=====\n\nInside your repository\n----------------------\n\nAdd \"use\" statement just like when you're using a trait.\n\n```php\n\u003c?php\n\nnamespace FoobarBundle\\Repository;\n\nuse Doctrine\\ORM\\EntityRepository;\nuse TangoMan\\RepositoryHelper\\RepositoryHelper;\n\n/**\n * Class FoobarRepository\n */\nclass FoobarRepository extends EntityRepository\n{\n    use RepositoryHelper;\n}\n```\n\nInside your controller\n----------------------\n\n```php\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nclass FoobarController extends Controller\n{\n    /**\n     * @Route(\"/\")\n     */\n    public function indexAction(Request $request)\n    {\n        // Show searchable, sortable, paginated user list\n        $em = $this-\u003eget('doctrine')-\u003egetManager();\n        $foobars = $em-\u003egetRepository('AppBundle:Foobar')-\u003efindByQuery($request);\n\n        return $this-\u003erender(\n            'admin/foobar/index.html.twig',\n            [\n                'foobars' =\u003e $foobars,\n            ]\n        );\n    }\n```\n\nInside your views\n-----------------\n\n### Search Form\n```twig\n\u003clabel for=\"inputUser\"\u003eUser\u003c/label\u003e\n\u003cinput type=\"text\" name=\"user-username\" id=\"inputUser\" class=\"form-control\"\n    value=\"{{ app.request.get('user-username')|join(', ') }}\"/\u003e\n```\nWill generate this:\n.../admin/posts/?user-username=admin\n\n### Order Link\n```twig\n\u003cth class=\"{{ app.request.query.get('order') == 'user-username' ? app.request.query.get('way', 'ASC') }}\"\u003e\n    \u003ca href=\"{{ path('app_admin_post_index', app.request.query.all|merge({\n        'page'  : 1,\n        'order' : 'user-username',\n        'way'   : app.request.query.get('order') == 'user-username'\n        and app.request.query.get('way', 'ASC') == 'ASC' ? 'DESC' : 'ASC'})) }}\"\u003e\n        User\n    \u003c/a\u003e\n\u003c/th\u003e\n```\nWill generate this:\n.../admin/posts/?page=1\u0026order=user-username\u0026way=ASC\n\nHelper Public Methods\n=====================\n\n|                       function                       |                                       description                                       |        parameters       |       return      |\n|------------------------------------------------------|-----------------------------------------------------------------------------------------|-------------------------|-------------------|\n| getTableName()                                       | Returns current table name                                                              | n/a                     | string            |\n| countBy($criteria = [])                                | Returns element count, filtered by given criteria                                       | array                   | integer           |\n| distinct($property, $criteria = [])                  | Lists distinct items from desired column, filtered by given criteria                    | string, array           | array             |\n| findAllPaged($page = 1, $limit = 10, $criteria = []) | Returns X results with pagination, starting from given page, filtered by given criteria | integer, integer, array | (object)Paginator |\n| findByQuery(Request $request, $criteria = [])        | Returns query result with pagination, filtered by given criteria                        | (object)Request, array  | (object)Paginator |\n| findByQueryScalar(Request $request, $criteria = [])  | Return query as scalar result with pagination, filtered by given criteria               | (object)Request, array  | (object)Paginator |\n| export(Request $request, $criteria = [])             | Return all objects as scalar result, filtered by given criteria                         | (object)Request, array  | array             |\n\nQuery Parameters\n================\n\n| parameter |   type  |         value          |\n|-----------|---------|------------------------|\n| order     | string  | switch-entity-property |\n| way       | string  | `(ASC/DESC)`           |\n| limit     | integer | `[1-9]+\\d?`            |\n| page      | integer | `[1-9]+\\d?`            |\n| join      | string  | switch-entity-property |\n\nSwitches\n========\n\nSwitch values for mode/operator/action\n\n| switch |   mode   | description |\n|--------|----------|-------------|\n| a      | andWhere | andWhere    |\n| b      | search   | boolean     |\n| c      | order    | count       |\n| e      | search   | exactMatch  |\n| l      | search   | like        |\n| n      | search   | notNull     |\n| o      | orWhere  | orWhere     |\n| p      | order    | property    |\n| r      | order    | orderBy     |\n| s      | search   | simpleArray |\n\nError\n=====\n\nWhen symfony raises following *QueryException* exception:\n\n\u003e \u0026lsqb;Semantical Error\u0026rsqb; line X, col XX near 'foo LIKE': Error: Invalid PathExpression. Must be a StateFieldPathExpression.\n\nIt means that you have an error inside your form: `\u003cinput name=\"foo-bar\"\u003e`, attribute doesn't target appropriate joined entity.\n\nTry `\u003cinput name=\"foo-bar-title\"\u003e`, or `\u003cinput name=\"bar-title\"\u003e`, **TangoMan Repository Helper** will automatically handle the join.\n\nNote\n====\n\nIf you find any bug please report here : [Issues](https://github.com/TangoMan75/RepositoryHelper/issues/new)\n\nLicense\n=======\n\nCopyright (c) 2018 Matthias Morin\n\n[![License][license-MIT]][license-url]\nDistributed under the MIT license.\n\nIf you like **TangoMan Repository Helper** please star!\nAnd follow me on GitHub: [TangoMan75](https://github.com/TangoMan75)\n... And check my other cool projects.\n\n[Matthias Morin | LinkedIn](https://www.linkedin.com/in/morinmatthias)\n\n[license-MIT]: https://img.shields.io/badge/Licence-MIT-green.svg\n[license-url]: LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangoman75%2Frepositoryhelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftangoman75%2Frepositoryhelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangoman75%2Frepositoryhelper/lists"}