guagay_wk
guagay_wk

Reputation: 28050

What is the difference between a table and entity in the context of Model in cakephp v3.x and what kind of code goes in?

In cakephp v3.x, the Model folder contains 3 folders - Behavior, Entity, Table. I am confused over what kind of code should I put in the Entity and Table files.

Should code related to retrieving data and resultsets be all be placed in the Table files? If yes, what sort of code should one place in the Entity files?

Upvotes: 4

Views: 3894

Answers (1)

Ofir Baruch
Ofir Baruch

Reputation: 10356

According to the cakephp 3.0 manual, the Model layer has been re-written and replaced. Consider reading the ORM Migration in order to understand the differences better.

Cake\ORM\Table - The main entry point into the new ORM. Provides access to a single table. Handles the definition of association, use of behaviors and creation of entities and query objects.

Cake\ORM\Entity - Represents a single row result. Makes accessing data and serializing to various formats a snap.

Upvotes: 8

Related Questions