Home php How to fix the Array to string conversion error?

How to fix the Array to string conversion error?

Author

Date

Category

Hello everyone !!! I can’t fix the error.
In the view I output echo $ form- & gt; textField ($ model- & gt; employees, "full_name_ru", array ('size' = & gt; 60, 'maxlength' = & gt; 255)); – & gt; employees is the garter in the 'employees' = & gt; array (self :: HAS_MANY, 'RefEmployeesMahala', 'mahala_id', 'order' = & gt; 'position_type ASC') . How do I fix this error? Yii1 project


Answer 1, authority 100%

textField () implies that the first element is the model or its name, you are passing an array of related models (employees ), which leads to a failure in the CHtml :: modelName . If you need to output textField () for each linked model, do so in a loop.


Answer 2, authority 25%

Don’t pass an array where you need to pass a string

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions