R
R
ragnar_ok2020-06-02 00:28:37
1C-Bitrix
ragnar_ok, 2020-06-02 00:28:37

How to check multiple fields for uniqueness?

Described the BookTable entity:

class BookTable extends Entity\DataManager
{
    public static function getMap()
    {
        return array(
            new Entity\IntegerField('ID'),
            new Entity\StringField('ISBN'),
            new Entity\StringField('TITLE'),
        );
    }
}


How to call BookTable::update()instead BookTable::add()if one of the rows of the table already has the added values ​​of the ISBN and TITLE fields (that is, this pair is not unique)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
PetrPo, 2020-06-02
@ragnar_ok

You do getList, with the filter on ISBN and TITLE.
Further condition, if the record is update, if not add

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question