简体   繁体   中英

where is symfony2 formerror class/component?

I am doing the following in my controller to manually check a form, now I get an error saying

Fatal error: Class 'BizTV\\ContentManagementBundle\\Controller\\formerror' not found in /var/www/cloudsign_beta/src/BizTV/ContentManagementBundle/Controller/DefaultController.php on line 233

so I suppose there is a fancy symfony form component I must add with a USE statement on top, anyone know which one?

    if ($nameOccupied=1) {          
        $error = new formerror("Det finns redan innehåll på denna plats med samma namn, vänligen välj ett annat namn (eller välj en annan plats).");
        $form->get('name')->addError($error);   
    }

You are missing the following use statement:

use Symfony\Component\Form\FormError

Reference: http://api.symfony.com/2.3/Symfony/Component/Form/FormError.html

Important : When creating an object, you should use the same case than the one from the class definition to avoid failure on case sensitive systems.
Here, new formerror should be new FormError

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM