Views: 3254
Last Modified: 29.03.2022
Objects convert values to field type. It means that values will have the value formats and string - the string formats:
$book = \Bitrix\Main\Test\Typography\BookTable::getByPrimary(1)
->fetchObject();
var_dump($book->getId());
// prints int 1
var_dump($book->getTitle());
// prints string 'Title 1' (length=7)
Please, be advised regarding to BooleanField: expects true or false, despite the fact that database could store other values:
//(new BooleanField('IS_ARCHIVED'))
// ->configureValues('N', 'Y'),
$book = \Bitrix\Main\Test\Typography\BookTable::getByPrimary(1)
->fetchObject();
var_dump($book->getIsArchived());
// prints boolean true
// set values are boolean as well
$book->setIsArchived(false);