Warning: The magic method SFML_Singleton::__wakeup() must have public visibility in /home/public/wp-content/plugins/sf-move-login/inc/classes/class-sfml-singleton.php on line 72
code – Page 2 – Thoughts, etc.

Thoughts, etc.

Tracking the occasional random walk

code

Adding many-to-many joins in CakePHP with newEntity

2016-11-26 / Leave a Comment

To allow CakePHP 3 to add entries to many-to-many join tables when creating or patching entities, the names of the associations must be added to the array of accessible concrete properties on the model. The documentation does mention this fact eventually, as a note in the “Patching HasMany and BelongsToMany” section, but not as part of … [Read more…]

Posted in: code Tagged: cakephp, notes

Testing routes with Laravel-Localization

2016-03-16 / 7 Comments

I recently added the Laravel-Localization package (with Laravel 5.2) to a project I’m working on. Initial setup went smoothly, and I was impressed with how well things worked essentially out of the box. Then I tried to test my routes. I had previously made a test case that ran through all of my public routes and asserted … [Read more…]

Posted in: code Tagged: laravel

Laravel 5.1 “intermediate quickstart” notes

2015-12-16 / Leave a Comment

I just ran through Laravel’s intermediate quickstart tutorial. On the whole it was rather well put together and worked with as little or as much copying and pasting as you felt like using. Here I’m just recording a few notes for future reference about non-obvious things I encountered. Error messages for simple typos One interesting … [Read more…]

Posted in: code Tagged: laravel, notes

Listing associated IDs during a Controller query in CakePHP 3

2015-04-28 / Leave a Comment

Yesterday I looked into adding a key-value pair such as  "tag_ids": [1, 2, 3] to a JSON object returned by a serialized CakePHP view, for Bookmarks belonging to many Tags. My solution produces the desired result, but involves the execution of a new database query for every bookmark, on top of the one that retrieved the record in the first place. This is not … [Read more…]

Posted in: code Tagged: cakephp

Array of associated IDs in CakePHP 3.0 “belongsToMany” relationship

2015-04-27 / 1 Comment

Today I was struggling with how to get CakePHP to return a JSON representation of a model, including a simple array of the foreign-key ids from the join table that specifies a mutual belongsToMany relationship (formerly, hasAndBelongsToMany or HABTM). For a concrete example, I wanted to build on the Bookmarker tutorial by creating an API endpoint to … [Read more…]

Posted in: code Tagged: cakephp
« Previous 1 2