CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 5.3 Chiffon API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 5.3
      • 5.3
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Global
  • Cake
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
      • Association
      • Attribute
      • Behavior
      • Exception
      • Locator
      • Query
      • Rule
    • Routing
    • TestSuite
    • Utility
    • Validation
    • View

Trait TableEventsTrait

Provides model callbacks.

Namespace: Cake\ORM

Method Summary

  • afterDelete() public

    The Model.afterDelete event is fired after an entity has been deleted.

  • afterDeleteCommit() public

    The Model.afterDeleteCommit event is fired after the transaction in which the delete operation is wrapped has been committed. It's also triggered for non atomic deletes where database operations are implicitly committed. The event is triggered only for the primary table on which delete() is directly called. The event is not triggered if a transaction is started before calling delete.

  • afterMarshal() public

    The Model.afterMarshal event is fired after request data is converted into entities. Event handlers will get the converted entities, original request data and the options provided to the patchEntity() or newEntity() call.

  • afterRules() public

    The Model.afterRules event is fired after an entity has rules applied. By stopping this event, you can return the final value of the rules checking operation.

  • afterSave() public

    The Model.afterSave event is fired after an entity is saved.

  • afterSaveCommit() public

    The Model.afterSaveCommit event is fired after the transaction in which the save operation is wrapped has been committed. It’s also triggered for non atomic saves where database operations are implicitly committed. The event is triggered only for the primary table on which save() is directly called. The event is not triggered if a transaction is started before calling save.

  • beforeDelete() public

    The Model.beforeDelete event is fired before an entity is deleted. By stopping this event you will abort the delete operation. When the event is stopped the result of the event will be returned.

  • beforeFind() public

    The Model.beforeFind event is fired before each find operation.

  • beforeMarshal() public

    The Model.beforeMarshal event is fired before request data is converted into entities.

  • beforeRules() public

    The Model.beforeRules event is fired before an entity has had rules applied. By stopping this event, you can halt the rules checking and set the result of applying rules.

  • beforeSave() public

    The Model.beforeSave event is fired before each entity is saved. Stopping this event will abort the save operation. When the event is stopped the result of the event will be returned.

  • buildValidator() public

    The Model.buildValidator event is fired when $name validator is created. Behaviors, can use this hook to add in validation methods.

Method Detail

afterDelete() ¶ public

afterDelete(Cake\Event\EventInterface<Cake\ORM\Table> $event, Cake\Datasource\EntityInterface $entity, ArrayObject<string, mixed> $options): void

The Model.afterDelete event is fired after an entity has been deleted.

Parameters
Cake\Event\EventInterface<Cake\ORM\Table> $event

Model event.

Cake\Datasource\EntityInterface $entity

Deleted entity.

ArrayObject<string, mixed> $options

Options.

Returns
void

afterDeleteCommit() ¶ public

afterDeleteCommit(Cake\Event\EventInterface<Cake\ORM\Table> $event, Cake\Datasource\EntityInterface $entity, ArrayObject<string, mixed> $options): void

The Model.afterDeleteCommit event is fired after the transaction in which the delete operation is wrapped has been committed. It's also triggered for non atomic deletes where database operations are implicitly committed. The event is triggered only for the primary table on which delete() is directly called. The event is not triggered if a transaction is started before calling delete.

Parameters
Cake\Event\EventInterface<Cake\ORM\Table> $event

Model event.

Cake\Datasource\EntityInterface $entity

Deleted entity.

ArrayObject<string, mixed> $options

Options.

Returns
void

afterMarshal() ¶ public

afterMarshal(Cake\Event\EventInterface<Cake\ORM\Table> $event, Cake\Datasource\EntityInterface $entity, ArrayObject<string, mixed> $data, ArrayObject<string, mixed> $options): void

The Model.afterMarshal event is fired after request data is converted into entities. Event handlers will get the converted entities, original request data and the options provided to the patchEntity() or newEntity() call.

Parameters
Cake\Event\EventInterface<Cake\ORM\Table> $event

Model event.

Cake\Datasource\EntityInterface $entity

The entity to be saved.

ArrayObject<string, mixed> $data

Data to be saved.

ArrayObject<string, mixed> $options

Options.

Returns
void

afterRules() ¶ public

afterRules(Cake\Event\EventInterface<Cake\ORM\Table> $event, Cake\Datasource\EntityInterface $entity, ArrayObject<string, mixed> $options, bool $result, string $operation): void

The Model.afterRules event is fired after an entity has rules applied. By stopping this event, you can return the final value of the rules checking operation.

Parameters
Cake\Event\EventInterface<Cake\ORM\Table> $event

Model event.

Cake\Datasource\EntityInterface $entity

The entity to be saved.

ArrayObject<string, mixed> $options

Options.

bool $result

Result.

string $operation

Operation.

Returns
void

afterSave() ¶ public

afterSave(Cake\Event\EventInterface<Cake\ORM\Table> $event, Cake\Datasource\EntityInterface $entity, ArrayObject<string, mixed> $options): void

The Model.afterSave event is fired after an entity is saved.

Parameters
Cake\Event\EventInterface<Cake\ORM\Table> $event

Model event.

Cake\Datasource\EntityInterface $entity

Saved entity.

ArrayObject<string, mixed> $options

Options.

Returns
void

afterSaveCommit() ¶ public

afterSaveCommit(Cake\Event\EventInterface<Cake\ORM\Table> $event, Cake\Datasource\EntityInterface $entity, ArrayObject<string, mixed> $options): void

The Model.afterSaveCommit event is fired after the transaction in which the save operation is wrapped has been committed. It’s also triggered for non atomic saves where database operations are implicitly committed. The event is triggered only for the primary table on which save() is directly called. The event is not triggered if a transaction is started before calling save.

Parameters
Cake\Event\EventInterface<Cake\ORM\Table> $event

Model event.

Cake\Datasource\EntityInterface $entity

Saved entity.

ArrayObject<string, mixed> $options

Options.

Returns
void

beforeDelete() ¶ public

beforeDelete(Cake\Event\EventInterface<Cake\ORM\Table> $event, Cake\Datasource\EntityInterface $entity, ArrayObject<string, mixed> $options): void

The Model.beforeDelete event is fired before an entity is deleted. By stopping this event you will abort the delete operation. When the event is stopped the result of the event will be returned.

Parameters
Cake\Event\EventInterface<Cake\ORM\Table> $event

Model event.

Cake\Datasource\EntityInterface $entity

Entity to be deleted.

ArrayObject<string, mixed> $options

Options.

Returns
void

beforeFind() ¶ public

beforeFind(Cake\Event\EventInterface<Cake\ORM\Table> $event, Cake\ORM\Query\SelectQuery $query, ArrayObject<string, mixed> $options, bool $primary): void

The Model.beforeFind event is fired before each find operation.

Parameters
Cake\Event\EventInterface<Cake\ORM\Table> $event

Model event.

Cake\ORM\Query\SelectQuery $query

Query.

ArrayObject<string, mixed> $options

Options.

bool $primary

true if it is the root query, false if it is the associated query.

Returns
void

beforeMarshal() ¶ public

beforeMarshal(Cake\Event\EventInterface<Cake\ORM\Table> $event, ArrayObject<string, mixed> $data, ArrayObject<string, mixed> $options): void

The Model.beforeMarshal event is fired before request data is converted into entities.

Parameters
Cake\Event\EventInterface<Cake\ORM\Table> $event

Model event.

ArrayObject<string, mixed> $data

Data to be saved.

ArrayObject<string, mixed> $options

Options.

Returns
void

beforeRules() ¶ public

beforeRules(Cake\Event\EventInterface<Cake\ORM\Table> $event, Cake\Datasource\EntityInterface $entity, ArrayObject<string, mixed> $options, string $operation): void

The Model.beforeRules event is fired before an entity has had rules applied. By stopping this event, you can halt the rules checking and set the result of applying rules.

Parameters
Cake\Event\EventInterface<Cake\ORM\Table> $event

Model event.

Cake\Datasource\EntityInterface $entity

The entity to be saved.

ArrayObject<string, mixed> $options

Options.

string $operation

Operation.

Returns
void

beforeSave() ¶ public

beforeSave(Cake\Event\EventInterface<Cake\ORM\Table> $event, Cake\Datasource\EntityInterface $entity, ArrayObject<string, mixed> $options): void

The Model.beforeSave event is fired before each entity is saved. Stopping this event will abort the save operation. When the event is stopped the result of the event will be returned.

Parameters
Cake\Event\EventInterface<Cake\ORM\Table> $event

Model event.

Cake\Datasource\EntityInterface $entity

The entity to be saved.

ArrayObject<string, mixed> $options

Options.

Returns
void

buildValidator() ¶ public

buildValidator(Cake\Event\EventInterface<Cake\ORM\Table> $event, Cake\Validation\Validator $validator, string $name): void

The Model.buildValidator event is fired when $name validator is created. Behaviors, can use this hook to add in validation methods.

Parameters
Cake\Event\EventInterface<Cake\ORM\Table> $event

Model event.

Cake\Validation\Validator $validator

Validator.

string $name

Name.

Returns
void
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs