Skip to content

Tag: cakephp-3.0

Where to put custom SQL code in CakePHP 3?

I’m building an application in CakePHP 3. It uses a number of legacy databases which are not built in the Cake conventions. I do not want to use any of the ORM features Cake provides, as it’s more tedious to set up all the relations than just write “Raw SQL”. We are also not going to m…

Clone entity and all related entities in CakePHP 3

In my CakePHP 3 app, I have a somewhat elaborate tree of entities that I need to clone and save. The root of the structure is a Questionnaire, a Questionnaire hasMany Questions, each Question hasMany Fields, etc. (it goes deeper). Now I want the user to be able to define a new questionnaire by copying an old …

Virtual fields with Cakephp 3

I need to have a virtual property in my user entity. I followed the CakePHP book. UserEntity.php In a controller I followed exactly the book and I only get a null value. Answer According to @ndm, the problem was due to a bad file naming. I named the user entity class UserEntity.php. The CakePHP name conventio…