Answer the question
In order to leave comments, you need to log in
Are there setters and getters in the Bitrix ORM?
Hello people.
Such a question:
Is there an ORM
class RbUrlListTable extends DataManager
{
public static function getFilePath()
{
return __FILE__;
}
public static function getTableName()
{
return 'rb_url_lists';
}
public static function getMap()
{
return array(
new IntegerField('ID', array(
'primary' => true,
'autocomplete' => true,
)),
new StringField('TITLE', array(
'required' => true,
)),
new StringField('ALIAS', array(
'required' => true,
)),
new TextField('PARAMS', array(
'required' => true,
)),
new TextField('SETTINGS', array(
'required' => true,
)),
);
}
}
Answer the question
In order to leave comments, you need to log in
In standard tables, I often see that the field contains a serialized array, and when requested without additional processing, it is returned deserialized. You can try to use it. But I did not check how it works in my tables.
Or write your own wrapper that will unpack json. Although a dubious exercise, an object is returned, not an array.
You can override getRow and use it.
A very interesting task. If you need to operate only after receiving the data, then the "Format Values"
mechanism from the ORM documentation is perfect for you .
In this case, you can use serialization or json at your discretion (I recommend serialization - it is more native and there is a chance that it will work in the performance module).
If you have MySQL higher than 5.7 version, you can add several Expression fields and extract keys from JSON as well as fields. Until we tried this option, our hands did not reach.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question