SatisAdmin\Model\Repository::create PHP Method

create() public static method

public static create ( string $type ) : Repository
$type string
return Repository
    public static function create($type)
    {
        $class = __NAMESPACE__ . '\\' . ucfirst($type) . 'Repository';
        return (new $class())->fromArray(['type' => $type]);
    }

Usage Example

Example #1
0
 /**
  * @param string $type
  * @param string $index
  *
  * @return string
  */
 public function retrieveRepositoryFormFragmentAction($type, $index)
 {
     $form = $this->getFormFactory()->createNamed('config');
     $form->add($this->getFormFactory()->createNamed('repositories'));
     $form['repositories']->add($this->getFormFactory()->createNamed($index, new RepositoryType()));
     $form['repositories'][$index]->setData(Repository::create($type));
     return $this->app->render('default/retrieveRepositoryFormFragment.html.twig', ['form' => $form['repositories'][$index]->createView()]);
 }
All Usage Examples Of SatisAdmin\Model\Repository::create