{"id":19418773,"url":"https://github.com/softmonkeyjapan/cakephp-objectify-behavior","last_synced_at":"2026-04-21T13:02:35.937Z","repository":{"id":7680966,"uuid":"9043972","full_name":"softmonkeyjapan/cakephp-objectify-behavior","owner":"softmonkeyjapan","description":"ObjectifyBehavior for CakePHP 2.x. Transform regular array returned by the ORM into object","archived":false,"fork":false,"pushed_at":"2014-09-10T22:29:46.000Z","size":137,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-07T17:41:26.014Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/softmonkeyjapan.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":"2013-03-27T01:11:48.000Z","updated_at":"2015-12-22T00:56:09.000Z","dependencies_parsed_at":"2022-08-19T18:01:17.564Z","dependency_job_id":null,"html_url":"https://github.com/softmonkeyjapan/cakephp-objectify-behavior","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softmonkeyjapan%2Fcakephp-objectify-behavior","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softmonkeyjapan%2Fcakephp-objectify-behavior/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softmonkeyjapan%2Fcakephp-objectify-behavior/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softmonkeyjapan%2Fcakephp-objectify-behavior/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softmonkeyjapan","download_url":"https://codeload.github.com/softmonkeyjapan/cakephp-objectify-behavior/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240599180,"owners_count":19826959,"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":"2024-11-10T13:15:02.764Z","updated_at":"2026-04-21T13:02:30.905Z","avatar_url":"https://github.com/softmonkeyjapan.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Objectify Behavior (Plugin CakePHP)\n\nObjectifyBehavior aims to convert the usual array that CakePHP return ( e.g, find() ) into an object.\n\n\n## Requirements\n\n* CakePHP 2.x\n* PHP5\n\n## Installation\n\n_[Manual]_\n\n* Download this: [https://github.com/SoftMonkeyJapan/ObjectifyBehavior/archive/master.zip](https://github.com/SoftMonkeyJapan/ObjectifyBehavior/archive/master.zip)\n* Unzip that download.\n* Go into the unzip folder\n* Copy the file `ObjectifyBehavior.php` to `Models/Behaviors`\n\n_[GIT Clone]_\n\nIn your `Models/Behaviors` directory type:\n\n```bash\ngit clone -b master git://github.com/SoftMonkeyJapan/ObjectifyBehavior.git\ncp ObjectifyBehavior/ObjectifyBehavior.php ./ObjectifyBehavior.php\n```\n\n\n## Usage\n\n### Initialization\n\nGo into your model :\n\n```php\n\u003c?php\nclass Post extends AppModel\n{\n\n}\n```\n\nThen if it does not exists yet, create the model attribute `actsAs` and add the Objectify behavior :\n\n```php\n\u003c?php\nclass Post extends AppModel\n{\n\t$public $actsAs = array('Objectify');\n}\n```\n\n\n### Configuration\n\nBy default, the behavior gonna return the data as usual, as an array. To turn `on/off` this feature you can do : \n\n```php\n\u003c?php\nclass PostsController extends AppController\n{\n\tpublic function index()\n\t{\n\t\t$this-\u003ePost-\u003eobjectify(true); // Enable\n\t\t$this-\u003ePost-\u003eobjectify(false); // Disable\n\t}\n}\n```\n\nAnd that's all. You're now good to go. You can simply access the attributes as an object : \n\n```php\n\u003c?php\nclass PostsController extends AppController\n{\n\tpublic function index()\n\t{\n\t\t$this-\u003ePost-\u003eobjectify(true);\n\n\t\t// Find first\n\t\t$post = $this-\u003ePost-\u003efind('first');\n\t\techo $post-\u003ename;\n\n\t\t// Example with a find all\n\t\t$posts = $this-\u003ePost-\u003efind('all');\n\t\tforeach ($posts as $post)\n\t\t{\n\t\t\techo $post-\u003ename;\n\t\t\techo $post-\u003econtent;\n\t\t}\n\t}\n}\n```\n\n\n## License\n\nYou are allowed to use it for whatever you want and whenever you want.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftmonkeyjapan%2Fcakephp-objectify-behavior","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftmonkeyjapan%2Fcakephp-objectify-behavior","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftmonkeyjapan%2Fcakephp-objectify-behavior/lists"}