Skip to content
This repository has been archived by the owner on Mar 4, 2019. It is now read-only.

3 0 compatibility #2

Merged
merged 1 commit into from
Jan 13, 2014
Merged

3 0 compatibility #2

merged 1 commit into from
Jan 13, 2014

Conversation

josegonzalez
Copy link
Owner

This pull request implements partial compatibility with the CakePHP 3.0 Entity specification.

  • Entity classes now are not wholly tied to the Model class, and have no reference to them
  • Model class is now treated as the Table class. Subsequently, missing Table methods have been added, where appropriate
  • Removal of helper methods - such as save and updateAll - from the Entity classes. This is because they belong in the Table class (which implements a sort of session) not in the Entity class.
  • Removed entity->isAllowed()
  • Entity class is now JsonSerializable. Woot
  • entity->toArray() returns a nested data structure, as opposed to top-level as in 3.x. For example, 3.x has ['name' => 'Jose', 'email' => 'mark@example.com'], whereas CakeEntity will have ['User' => ['name' => 'Jose', 'email' => 'mark@example.com']]. This is to deal with data saving - we will leave the 2.x saving largely untouched so that the entities can be easily used in the FormHelpers for instance.
  • PHP 5.4+ required.

Todo:

  • Write tests for data saving
  • Implement EntityModel::alias()
  • Implement EntityModel::connection()
  • Implement EntityModel::association()
  • Implement EntityModel::associations()
  • Implement Entity::validate()
  • Move serialization of entities into a Marshaller class, similar to how 3.x has

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 62ab865 on 3-0-compatibility into 22a0be5 on master.

josegonzalez added a commit that referenced this pull request Jan 13, 2014
@josegonzalez josegonzalez merged commit 0f66392 into master Jan 13, 2014
@josegonzalez josegonzalez deleted the 3-0-compatibility branch January 13, 2014 04:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants