Showing posts with label cakephp3. Show all posts
Showing posts with label cakephp3. Show all posts

Saturday, July 3, 2021

Getting associated data in CakePHP 3 loaded using 'contain'

 So you've loaded associated data using 'contain' eg:

$object_attributes = $object_attributes_table 
->find("all", ["contain" => ["attributes"]]) 
->where(["object_id = " => $object_id]);

So how do actually access the data? 

Well it's stored as an array. So in the above example to get the attribute name:

$name = $object_attribute->Attributes['name'];


 

Friday, April 16, 2021

Helper Directory in CakePHP 3

 The helper directory is located in the View directory:

ie: src\View\Helper

(I posted this as I rarely need to find it and often forget where it lives!)


Tuesday, September 17, 2019

How to Bake in CakePHP 3


  1. In the command console go to your project root directory. In my case this is:
    C:\wamp64\www\colab
  2. Enter the command like: 
    • cake bake all TableNameLikeThis
    • cake bake controller TableNameLikeThis
    • cake bake model TableNameLikeThis
    • cake bake template TableNameLikeThis