DouhuomallChangeLogRepository.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace app\common\repositories\douhuomall;
  3. use app\common\dao\douhuomall\DouhuomallChangeLogDao;
  4. use app\common\repositories\BaseRepository;
  5. use app\entity\data\douhuomall\DouhuomallChangeLogEntity;
  6. class DouhuomallChangeLogRepository extends BaseRepository
  7. {
  8. protected $dao;
  9. /**
  10. * DouhuomallChangeLogRepository constructor.
  11. * @param DouhuomallChangeLogDao $dao
  12. */
  13. public function __construct(DouhuomallChangeLogDao $dao)
  14. {
  15. $this->dao = $dao;
  16. }
  17. public function create($data)
  18. {
  19. return $this->dao->create($data);
  20. }
  21. /**
  22. * @param DouhuomallChangeLogEntity $douhuomallChangeLogEntity
  23. * @return DouhuomallChangeLogEntity
  24. */
  25. public function createByEntity(DouhuomallChangeLogEntity $douhuomallChangeLogEntity): DouhuomallChangeLogEntity
  26. {
  27. $result = $this->create($douhuomallChangeLogEntity->toUnderlineArray())->toArray();
  28. /** @var DouhuomallChangeLogEntity $entity */
  29. $entity = DouhuomallChangeLogEntity::newInstance($result);
  30. return $entity;
  31. }
  32. }