/** * Get entity by type * * @param string $type * @param int $limit * @param int $page * @param string $sort * @return array */ public function getByType($type, $limit = null, $page = null, $sort = null) { $entityType = is_numeric($type) ? Table\EntityTypes::findById($type) : Table\EntityTypes::findBy(['name' => $type]); $rows = []; if (isset($entityType->id)) { $rows = $this->getAll($entityType->id, $limit, $page, $sort); } return $rows; }