/** * 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())); } }
/** * Handle the command. * * @param StreamRepositoryInterface $streams * @param TypeRepositoryInterface $types * @param Repository $config */ public function handle(StreamRepositoryInterface $streams, TypeRepositoryInterface $types, Repository $config) { /* @var TypeInterface $type */ $type = $types->find($this->type->getId()); /* @var StreamInterface $stream */ $stream = $type->getEntryStream(); $stream->fill([$config->get('app.fallback_locale') => ['name' => $this->type->getName(), 'description' => $this->type->getDescription()], 'slug' => $this->type->getSlug() . '_posts']); $streams->save($stream); }
/** * Handle the command. * * @param TypeRepositoryInterface $types * @return TypeInterface|null */ public function handle(TypeRepositoryInterface $types) { if (is_numeric($this->identifier)) { return $types->find($this->identifier); } if (is_string($this->identifier)) { return $types->findBySlug($this->identifier); } if ($this->identifier instanceof Presenter) { return $this->identifier->getObject(); } if ($this->identifier instanceof TypeInterface) { return $this->identifier; } return null; }
/** * Handle the command. * * @param TypeRepositoryInterface $types * @param PostFormBuilder $builder * @param Request $request */ public function handle(TypeRepositoryInterface $types, PostFormBuilder $builder, Request $request) { $this->builder->addForm('post', $builder->setType($types->find($request->get('type')))); }
/** * Handle the command. * * @param TypeRepositoryInterface $types * @param EntryFormBuilder $builder * @param Request $request */ public function handle(TypeRepositoryInterface $types, EntryFormBuilder $builder, Request $request) { $type = $types->find($request->get('type')); $this->builder->addForm('entry', $builder->setModel($type->getEntryModelName())); }
/** * Return a form for an existing post type field and assignment. * * @param AssignmentFormBuilder $form * @param TypeRepositoryInterface $types * @param BreadcrumbCollection $breadcrumbs * @param $id * @return \Symfony\Component\HttpFoundation\Response */ public function assignment(AssignmentFormBuilder $form, TypeRepositoryInterface $types, BreadcrumbCollection $breadcrumbs, $id, $assignment) { $type = $types->find($id); $breadcrumbs->put('module::breadcrumb.fields', 'admin/posts/types/fields/' . $type->getId()); return $form->render($assignment); }