get_class() expects parameter 1 to be object, array given
Try to use bundle and after I put line:
include('FpJsFormValidatorBundle::javascripts.html.twig')
in my template, I have error:
Twig_Error_Runtime: An exception has been thrown during the rendering of a template ("get_class() expects parameter 1 to be object, array given") in "/home/tobur/www/cj2/vendor/fp/jsformvalidator-bundle/Fp/JsFormValidatorBundle/Resources/views/javascripts.html.twig" at line 3.
For more clear, in my form I add field somethink like this:
$builder->add(
AccountingImport::KEY_RENT,
'text',
array(
'attr' => array(
'class' => 'half-width',
'data-bind' => 'value: '.AccountingImport::KEY_RENT
),
'constraints' => $this->accountingImport->getValidatorsByKey(AccountingImport::KEY_RENT)
)
);
Array ( [0] => Symfony\Component\Validator\Constraints\NotBlank Object ( [message] => This value should not be blank. [groups] => Array ( [0] => Default )
)
[1] => Symfony\Component\Validator\Constraints\Regex Object
(
[message] => This value is not valid.
[pattern] => /^[0-9]+(\.[0-9][0-9])?+$/
[htmlPattern] =>
[match] => 1
[groups] => Array
(
[0] => Default
)
)
)
TODO: write tests to check if symfony works with two-dimensional arrays of constraints