Probleme seit der Nachbildung meiner Datenbank haben
Posted: 01 Feb 2025, 08:43
Ich habe einen Controller in meinem API -Ordner namens CrudScontroller und ich habe diese Funktion. Was ich nicht verstehe, ist, dass dies ordnungsgemäß funktioniert, bevor ich Probleme mit meiner Datenbank hatte, die ich neu erstellen musste. Jetzt erhalte ich diese Fehlermeldung: < /p>
Fehlende Methode in CrudScontroller
Fehler: Die Aktion API_ADD ist nicht in Controller CrudsController < /p>
definiert., Einschränkung cruds_ibfk_1 Fremdschlüssel () Referenzen Status ())
Fehlende Methode in CrudScontroller
Fehler: Die Aktion API_ADD ist nicht in Controller CrudsController < /p>
definiert
Code: Select all
> public function add()
> {
> if ($this->request->is('post')) {
> $this->Crud->create();
> if ($this->Crud->save($this->request->data)) {
>
> if (isset($this->request->data['Crud']) && isset($this->request->data['Crud']['email'])) {
>
> $email = new CakeEmail('default'); // Use the 'default' configuration
>
> Specify the from address as 'no-reply@gmail.com'
> $email->from(array('no-reply@gmail.com' => 'Your Application'))
> ->replyTo('no-reply@gmail.com') // Set the "Reply-To" header to no-reply address
> ->to($this->request->data['Crud']['email'])
> ->subject('Notification')
> ->send('Your data has been successfully saved.');
>
> Debug statement
> $this->log('Email sent to: ' . $this->request->data['Crud']['email'], 'debug');
> else {
> Debug statement
> $this->log('Email not sent: Email address not found in request data', 'debug');
> }
>
> $response = array(
> 'ok' => true,
> 'msg' => 'saved!',
> 'data' => $this->request->data,
> );
> else {
> $response = array(
> 'ok' => false,
> 'msg' => 'not saved!',
> 'data' => $this->request->data,
> );
> }
>
> $this->set(array(
> 'response' => $response,
> '_serialize' => 'response'
> ));
> }
> }
< /code>
Ich habe versucht, es an öffentliche Funktionen zu bearbeiten api_add. Aber danach ist dies der Fehler, den ich bekomme. Ich möchte nur Schlüsselbeschränkungen schlägt fehl (ednc
Code: Select all
cruds
Code: Select all
status_id
Code: Select all
id