I developed a website using Symfony2, and I deleted it accidentally. Unfortunately, I have succeeded to restore its source folder from the hard disk of my computer thanks to a recovery software. I have also restored the database. When testing whether the website works correctly like before or not, I figured out that there is a problem: In a page that contains a Fullcalendar calendar, when clicking on anywhere in the calendar, a pop-up window must show up containing the form of adding a new event. But what I see on my computer screen when doing that is a pop-up window containing this error message:
Case mismatch between loaded and declared class names: Ikproj\HomeBundle\Form\eventstype vs Ikproj\HomeBundle\Form\eventsType
Then, I checked out the name of the file that is related to the form of adding a new event. And I figured out that it is eventsType.php (not "eventstype.php"). This is the code that such a file contains:
<?php
namespace Ikproj\HomeBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class eventsType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('title','text')
->add('start','datetime',array(
'input' => 'datetime',
'format' => 'dd/MM/yyyy H:i',
'minutes' => array(0,30)))
->add('end','datetime',array(
'input' => 'datetime',
'format' => 'dd/MM/yyyy H:i',
'minutes' => array(0,30)))
->add('location','text')
->add('description','textarea', array('attr' => array('rows' => '5','cols' => '40')));
}
/**
* @param OptionsResolverInterface $resolver
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Ikproj\HomeBundle\Entity\events'
));
}
/**
* @return string
*/
public function getName()
{
return 'ikproj_homebundle_events';
}
}
As you can notice from the code above, the name of the class is eventsType (not "eventstype"). Actually, everything in my website had been working very well before it was deleted accidentally. So, my questions are:
You can solve this by changing the call of your form in your Controller because you are probably using this:
use Ikproj\HomeBundle\Form\eventstype;
Instead of this:
use Ikproj\HomeBundle\Form\eventsType;