SharedProsperityRecommendConfigRepository.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace app\common\repositories\shared;
  3. use app\common\dao\shared\SharedProsperityRecommendConfigDao;
  4. use app\common\repositories\BaseRepository;
  5. use app\entity\data\shared\SharedProsperityRecommendConfigEntity;
  6. class SharedProsperityRecommendConfigRepository extends BaseRepository
  7. {
  8. protected $dao;
  9. /**
  10. * SharedProsperityUserRepository constructor.
  11. * @param SharedProsperityRecommendConfigDao $dao
  12. */
  13. public function __construct(SharedProsperityRecommendConfigDao $dao)
  14. {
  15. $this->dao = $dao;
  16. }
  17. public function create($data)
  18. {
  19. return $this->dao->create($data);
  20. }
  21. /**
  22. * @param SharedProsperityRecommendConfigEntity $sharedProsperityRecommendConfigEntity
  23. * @return SharedProsperityRecommendConfigEntity
  24. */
  25. public function createByEntity(SharedProsperityRecommendConfigEntity $sharedProsperityRecommendConfigEntity): SharedProsperityRecommendConfigEntity
  26. {
  27. $result = $this->create($sharedProsperityRecommendConfigEntity->toUnderlineArray())->toArray();
  28. /** @var SharedProsperityRecommendConfigEntity $entity */
  29. $entity = SharedProsperityRecommendConfigEntity::newInstance($result);
  30. return $entity;
  31. }
  32. /**
  33. * @return array
  34. * @author 史晨
  35. * @date 2026/2/5 14:12
  36. */
  37. public function getList(): array
  38. {
  39. return $this->dao->getConfigList();
  40. }
  41. }