How to look at the json string in the database?

Good afternoon. There is a line in a DB (mysql) view
where tm1 is the time tm2 and the time of closing. In yii2 using ActiveRecord to search for these kinds of line? The fact that this row of items can be limited, and each time refers to your interval...
July 2nd 19 at 13:27
2 answers
July 2nd 19 at 13:29
Yii2 does not provide built-in functions to AR to fetch data in JSON fields. To begin, write the SQL query selects the data You need and then decide how to translate it into Yii. In the case of MySQL do not understand what justifies storing the JSON array if you want to search. It would be better to redesign the database
Inherited from a previous developer. Now just think about that-be to reverse engineer, but there difficulties arise, well and in a makeweight a lot of data stored in the database... - camren.Donnel commented on July 2nd 19 at 13:32
: well then only need to deal with MySQL's capabilities to work with JSON ( and write initially, the query itself on the database tier, and then transferred to the model - bryana.Renn commented on July 2nd 19 at 13:35
July 2nd 19 at 13:31
If we need to store the data, it is best to use a special type for the column.
appeared in PostgreSql jsonb. It is possible in mysql too, is already there.
Yes there is, but he's in mysql 5.7 and mysql 5.5 I have used APAT version of the DBMS the management flatly refused, so I have long used that option which I wrote above - camren.Donnel commented on July 2nd 19 at 13:34
Then, frankly, the correct answer is as described above, to redesign the database. Subsequently, yourself will alleviate a big headache. - bryana.Renn commented on July 2nd 19 at 13:37
: did - camren.Donnel commented on July 2nd 19 at 13:40

Find more questions by tags Yii