/** * Handle the command. * * @param TypeRepositoryInterface $types * @param PostRepositoryInterface $posts */ public function handle(TypeRepositoryInterface $types, PostRepositoryInterface $posts) { /* @var TypeInterface $type */ $type = $types->find($this->type->getId()); /* @var PostInterface $post */ foreach ($type->getPosts() as $post) { $posts->save($post->setAttribute('entry_type', $this->type->getEntryModelName())); } }