#D7

D7 Работа с ExpressionField в getList

10.10.2016 Bitrix, php, php скрипты ,


$resOrder = Bitrix\Sale\OrderTable::getList(
    array(
        'filter' => array('=USER_ID' => 1),
        'group' => array('PAYED'),
        'runtime' => array(           
            new Bitrix\Main\Entity\ExpressionField('IDS', 'GROUP_CONCAT(%s)', array('ID')),
        ),
    )
);

Bitrix d7 получить список пользователей по группам

10.08.2016 Bitrix, php, php скрипты ,

           $arUsers = Bitrix\Main\UserGroupTable::getList(
		array(
			'order'=>array('USER_ID' => 'asc'),
			'group'=>array('USER_ID'),
			'select' => array(
				'USER_ID',
				'USER_DATE_REGISTER' => 'USER.DATE_REGISTER',
				'USER_ACTIVE' => 'USER.ACTIVE',
				'USER_EMAIL' => 'USER.EMAIL',
				'USER_LOGIN' => 'USER.LOGIN',
				'USER_WORK_COMPANY' => 'USER.WORK_COMPANY',
				'USER_NAME' => 'USER.NAME',
				'USER_GROUP_STR',
			),
			'filter' => array(
				'GROUP.ACTIVE' => 'Y',
				'USER.ACTIVE' => 'Y',
				'GROUP_ID' => array(3, 4),
				array(
					'LOGIC' => 'OR',
					'=DATE_ACTIVE_FROM' => null,
					'<=DATE_ACTIVE_FROM' => $nowTimeExpression,
				),
				array(
					'LOGIC' => 'OR',
					'=DATE_ACTIVE_TO' => null,
					'>=DATE_ACTIVE_TO' => $nowTimeExpression,
				),
			),
			'runtime' => array(
				'USER_GROUP_STR' => array(
					'data_type' => 'string',
					'expression' => array('GROUP_CONCAT(%s)', 'GROUP_ID')
				),

			)
		)
	)->fetchAll();

Bitrix d7 getList runtime

27.07.2016 Bitrix , , ,

Два разных способа записи runtime сущностей

            if(!class_exists('Bitrix\Sale\Internals\OrderPropsValueTable')){
                CModule::AddAutoloadClasses(
                    "",
                    array(
                        'Bitrix\Sale\Internals\OrderPropsValueTable' => "/bitrix/modules/sale/distr/lib/internals/orderprops_value.php",
                        'Bitrix\Sale\Internals\OrderPropsTable' => "/bitrix/modules/sale/distr/lib/internals/orderprops.php",
                    )
                );
            }

            $arOrder = Bitrix\Sale\OrderTable::getRow(
                array(
                    'filter' => array(
                        '=ID' => 36835, 'LID' => 's1'
                    ),
                    'select' => array(
                        'ID', 'PRICE',
                        'ADDRESS' => 'ADDRESS_ORDER.VALUE'
                    ),
                    'runtime' => array(
                        'ADDRESS_ORDER' => array(
                            'data_type' => 'Bitrix\Sale\Internals\OrderPropsValueTable',
                            'reference' => array(
                                '=ref.CODE' => new Bitrix\Main\DB\SqlExpression('?s', 'ADDRESS'),
                                '=this.ID' => 'ref.ORDER_ID',
                            )
                        ),
                        new Bitrix\Main\Entity\ReferenceField(
                            'ADDRESS_ORDER',
                            'Bitrix\Sale\Internals\OrderPropsValueTable',
                            array(
                                '=ref.CODE' => new Bitrix\Main\DB\SqlExpression('?s', 'ADDRESS'),
                                '=this.ID' => 'ref.ORDER_ID',
                            )
                        )
                    )
                )
            );