Answer the question
In order to leave comments, you need to log in
How to get a value from several entities in Bitrix using ORM?
Good afternoon!
I faced the task of fetching values from two different entities (deals and contacts), but I can't figure out how to do it.
An example of extracting data from a deal:
use Bitrix\Crm\DealTable;
use Bitrix\Crm\ContactTable;
$arDeal = DealTable::getList(array(
'select' => array('CONTACT_ID'),
'filter' => array('CREATED_BY_ID'=>1)
))->fetchAll();
Answer the question
In order to leave comments, you need to log in
Here you can read about the relationship between ORM entities.
If the entities you're asking about are related, then this is pretty easy.
Let's say this is how the field is described for which there is a connection between the Book entity and Author inside the BookTable class:
new Entity\ReferenceField(
'AUTHOR',
'SomePartner\MyBooksCatalog\Author',
array('=this.AUTHOR_ID' => 'ref.ID'),
array('join_type' => 'LEFT')
)
BookTable::getList(array(
'select' => array(
'TITLE',
'AUTHOR_NAME' => 'AUTHOR.NAME',
'AUTHOR_LAST_NAME' => 'AUTHOR.LAST_NAME'
)
));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question