exam questions

Exam Magento 2 Certified Associate Developer All Questions

View all questions & answers for the Magento 2 Certified Associate Developer exam

Exam Magento 2 Certified Associate Developer topic 1 question 9 discussion

Actual exam question from Magento's Magento 2 Certified Associate Developer
Question #: 9
Topic #: 1
[All Magento 2 Certified Associate Developer Questions]

Assume that $collection is a new instance of a class that extends
Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection, and $ids is an array of ids.
How do you select a list of records from the database where the record ids are in the $ids list?

  • A. $collection->addFieldToFilter('record_id',['in'=>$ids]); B.
  • C. $collection->in($ids);
  • D. $collection->filterIn($ids);
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️
Reference:
https://magento.stackexchange.com/questions/121040/how-to-get-product-collections-by-set-of-ids-in-magento-2

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Currently there are no comments in this discussion, be the first to comment!
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...