protected function create(ICommand $command) { $category = new Category(); $category->title = $command->title; $category->slug = $command->slug; $category->main_image = $command->main_image; $category->main_image_alt = $command->main_image_alt; $category->you_tube_video_id = $command->you_tube_video_id; $category->summary = $command->summary; $category->content = $command->content; $category->is_sticky = $command->is_sticky; $category->meta_description = $command->meta_description; $category->meta_keywords = $command->meta_keywords; $category->status = $command->status; $this->repository->save($category); $this->dispatcher->dispatch($category->releaseEvents()); }
protected function update(ICommand $command) { $post = $this->repository->findById($command->post_id); $post->title = $command->title; $post->slug = $command->slug; $post->main_image = $command->main_image; $post->main_image_alt = $command->main_image_alt; $post->you_tube_video_id = $command->you_tube_video_id; $post->summary = $command->summary; $post->content = $command->content; $post->is_sticky = $command->is_sticky; $post->meta_description = $command->meta_description; $post->meta_keywords = $command->meta_keywords; $post->status = $command->status; $this->repository->save($post); $this->dispatcher->dispatch($post->releaseEvents()); }