Cameron
Cameron

Reputation: 28853

CakePHP Forgot Password / Ticket component help

I'm using the following tutorial to build a password reset form: http://bakery.cakephp.org/articles/eimermusic/2007/10/23/ticket-component-resetting-user-passwords

However when I submit the form I get the following error: Fatal error: Class 'Ticket' not found in /Users/cameron/Sites/thehive/app/controllers/components/tickets.php on line 60

And Line 60 is this: $ticketObj = new Ticket();

Any ideas what the problem is and how to fix it thanks?

Upvotes: 0

Views: 609

Answers (3)

AKKAweb
AKKAweb

Reputation: 3807

Hey... it would make sense if you post your Ticket model class here. Looking back at the tutorial, I don't understand why the duplicates

<?php //why duplicate
<?php //why duplicate
class Ticket extends AppModel
{
    var $name = 'Ticket';    
}
?> //why duplicate
?> //why duplicate 

. I am not sure if that would cause problem as I have never tried it before. If you copy the code as is, that might be the issue. I am not sure....

Upvotes: 0

dhofstet
dhofstet

Reputation: 9964

Models are not automatically available in components. One possible way to import your model class is:

App::import('Model','Ticket');

Upvotes: 2

Tim
Tim

Reputation: 5943

I'm pretty sure you just forgot to create the Ticket model class:

<?php
class Ticket extends AppModel
{
    var $name = 'Ticket';    
}
?>

Just put this in a file "ticket.php" within your /app/model directory.

Upvotes: 0

Related Questions