Crud Subject

The Crud Subject is the class which is passed as the subject of all the events that the Crud plugin emits during its execution. Depending on the action being scaffolded, and what it’s working on the contents of the subject can be different.

Core event subjects

You can find many of the subject contents are included as part of the Core Crud Events documentation. This is because the subject of the event is very specific to the event being emitted.

When dealing with listeners, you are able to manipulate the subject of the event in order to change Crud’s behavior. Such as changing pagination, or adding extra conditions to a query.

This is an example of the data passed in a beforeFind event subject.

<?php
public function view($id)
{
    $this->Crud->on('beforeFind', function (\Cake\Event\Event $event) {
        $query = $event->getSubject()->query;
        $primaryKey = $event->getSubject()->id;
        $table = $event->getSubject()->repository;
    });
}

Find more examples in the Core Crud Events documentation, for the event you need.

  v: latest
Versions
latest
stable
5.1.0
5.0.0
4.4.4
4.4.3
4.4.2
4.4.1
4.4.0
4.3.5
4.3.4
4.3.3
4.3.2
4.3.1
4.3.0
4.2.4
4.2.3
4.2.2
v4.0.0
cake3
Downloads
pdf
htmlzip
epub
On Read the Docs
Project Home
Builds
Downloads
On GitHub
View
Edit

Free document hosting provided by Read the Docs.