Let's start with EAV model collections. We can instantiate the collection either through the entity factory
class like follows:
$collection = $this->employeeFactory->create() ->getCollection();
Or we can use object manager to instantiate the collection as shown next:
$collection = $this->_objectManager->create( 'Foggyline\Office\Model\ResourceModel\Employee\Collection's );
There is also a third way, which might be the preferred one, but it requires us to define APIs so we will skip that one for the moment.
Once we instantiate the collection object, we can loop through it and do some variable dumps to see the content on individual $employee
entities, like shown next:
foreach ($collection as $employee) { \Zend_Debug::dump($employee->toArray(), '$employee'); }
The preceding would yield results like the following:
$employee array(5) { ["entity_id"] => string(2) "24" ["department_id"] => string(2) "27" ["email"] => string...