当前位置: 首页>>代码示例>>PHP>>正文


PHP Repository::create方法代码示例

本文整理汇总了PHP中Repository::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::create方法的具体用法?PHP Repository::create怎么用?PHP Repository::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Repository的用法示例。


在下文中一共展示了Repository::create方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: all

 /**
  * @return ModelCollection
  */
 public function all()
 {
     $collection = new ModelCollection();
     foreach ($this->allAsArray() as $row) {
         $collection->push($this->repository->create($this->fromDatabaseFilter($row)));
     }
     return $collection;
 }
开发者ID:serendip811,项目名称:patio42,代码行数:11,代码来源:QueryBuilder.php

示例2: createRepository

 /**
  * Creates a new repository on the specified path
  *
  * @param string $path Path where the new repository will be created
  * @return Repository Instance of Repository
  */
 public function createRepository($path)
 {
     if (file_exists($path . '/.git/HEAD') && !file_exists($path . '/HEAD')) {
         throw new \RuntimeException('A GIT repository already exists at ' . $path);
     }
     $repository = new Repository($path, $this);
     return $repository->create();
 }
开发者ID:nvdnkpr,项目名称:gitlist,代码行数:14,代码来源:Client.php

示例3: processFile

	public static function processFile($path, $name){
		$repository = Repository::create(uniqid() . "/$name");
		
		if(Source::analyzable($path)){
			$source = Source::create($path, "upload");
			$repository->add($source->id);
		}
		
		$repository->save();
		
		return $repository->id;
	}
开发者ID:nickyleach,项目名称:OSS-Match,代码行数:12,代码来源:Upload.php

示例4: create

 /**
  * 
  * @param array $givenParameters
  * @return integer
  */
 public static function create($givenParameters, $origin = "wizard", $route = "", $validate = true, $validateMandatory = true)
 {
     if (isset($givenParameters['password']) && $givenParameters['password']) {
         $givenParameters['password2'] = static::generateHashedPassword($givenParameters);
     }
     $currentDate = date('Y-m-d H:i:s');
     $givenParameters['createdat'] = $currentDate;
     $givenParameters['updatedat'] = $currentDate;
     $userId = parent::create($givenParameters, $origin, $route, $validate, $validateMandatory);
     $contactId = ContactRepository::create(array('description' => $givenParameters['login'] . " contact"), $origin, $route, false, false);
     parent::update(array('object_id' => $userId, 'contact_id' => $contactId), $origin, $route, false, false);
     return $userId;
 }
开发者ID:NicolasLarrouy,项目名称:centreon,代码行数:18,代码来源:UserRepository.php

示例5: testAutoEagerLoading

 public function testAutoEagerLoading()
 {
     $person = new Person();
     // We expect a new person to contain the
     // relations defined with the ResourceInterface 'unit'.
     $person = $this->repository->create($person);
     $this->assertEquals(0, $person->roles->count());
     $this->assertEquals(0, $person->children->count());
     // Check auto-eager-loading.
     $homer = $this->repository->find(1);
     $this->assertEquals(1, $homer->roles->count());
     $this->assertEquals(3, $homer->children->count());
     $simpsons = $this->repository->all();
     $simpsons = json_decode(json_encode($simpsons));
     $this->assertEquals(1, count($simpsons[0]->roles));
     $this->assertFalse(property_exists($simpsons[0], 'children'));
     // Check that repository with() method override default settings.
     $simpsons = $this->repository->with(['roles', 'children'])->all();
     $simpsons = json_decode(json_encode($simpsons));
     $this->assertEquals(1, count($simpsons[0]->roles));
     $this->assertEquals(3, count($simpsons[0]->children));
 }
开发者ID:foothing,项目名称:laravel-repository,代码行数:22,代码来源:EloquentRepositoryTest.php

示例6: Translation

            $ratatoeskr_settings["default_section"] = $section->get_id();
            $ratatoeskr_settings->save();
            $admingrp = Group::create("admins");
            $admin = user::create($_POST["admin_username"], PasswordHash::create($_POST["admin_init_password"]));
            $admin->save();
            $admingrp->include_user($admin);
            $article = Article::create("congratulations");
            $article->title["en"] = new Translation("Congratulations! You have just installed Ratatöskr!", "");
            $article->text["en"] = new Translation("Congratulations! You have just installed Ratatöskr!", "Markdown");
            $article->excerpt["en"] = new Translation("Congratulations! You have just installed Ratatöskr!", "Markdown");
            $article->status = ARTICLE_STATUS_LIVE;
            $article->timestamp = time();
            $article->allow_comments = True;
            $article->set_section($section);
            $article->save();
            try {
                Repository::create("http://r7r-repo-community.silvasur.net/");
                Repository::create("http://r7r-repo-official.silvasur.net/");
            } catch (RepositoryUnreachableOrInvalid $e) {
                $ste->vars["notice"] = $translation["could_not_initialize_repos"];
            }
            /* Almost done. Give the user the config file. */
            $config = "<?php\n\ndefine(\"__DEBUG__\", False);\ndefine(\"CONFIG_FILLED_OUT\", True);\ndefine(\"PLUGINS_ENABLED\", True);\n\n\$config[\"mysql\"][\"server\"] = '" . addcslashes($config["mysql"]["server"], "'") . "';\n\$config[\"mysql\"][\"db\"]     = '" . addcslashes($config["mysql"]["db"], "'") . "';\n\$config[\"mysql\"][\"user\"]   = '" . addcslashes($config["mysql"]["user"], "'") . "';\n\$config[\"mysql\"][\"passwd\"] = '" . addcslashes($config["mysql"]["passwd"], "'") . "';\n\$config[\"mysql\"][\"prefix\"] = '" . addcslashes($config["mysql"]["prefix"], "'") . "';\n\n?>";
            $ste->vars["config"] = $config;
            die($ste->exectemplate("/systemtemplates/setup_done.html"));
        } catch (MySQLException $e) {
            $ste->vars["error"] = $e->getMessage();
        }
    }
}
echo $ste->exectemplate("/systemtemplates/setup_dbsetup.html");
开发者ID:ratatoeskr-cms,项目名称:ratatoeskr-cms,代码行数:31,代码来源:setup.php

示例7: build_backend_subactions


//.........这里部分代码省略.........
            if ($properties[1]) {
                $ste->vars["textprocessors"][] = $txtproc;
            }
        }
        $ste->vars["sections"] = array();
        foreach (Section::all() as $section) {
            $ste->vars["sections"][] = $section->name;
        }
        $ste->vars["article_section"] = $default_section->name;
        /* Check Form */
        $fail_reasons = array();
        if (isset($_POST["save_article"])) {
            if (!Article::test_urlname($_POST["urlname"])) {
                $fail_reasons[] = $translation["invalid_urlname"];
            } else {
                $inputs["urlname"] = $_POST["urlname"];
            }
            if (!Article::test_status(@$_POST["article_status"])) {
                $fail_reasons[] = $translation["invalid_article_status"];
            } else {
                $inputs["article_status"] = (int) $_POST["article_status"];
            }
            if (!isset($textprocessors[@$_POST["content_txtproc"]])) {
                $fail_reasons[] = $translation["unknown_txtproc"];
            } else {
                $inputs["content_txtproc"] = $_POST["content_txtproc"];
            }
            if (!isset($textprocessors[@$_POST["excerpt_txtproc"]])) {
                $fail_reasons[] = $translation["unknown_txtproc"];
            } else {
                $inputs["excerpt_txtproc"] = $_POST["excerpt_txtproc"];
            }
            if (!empty($_POST["date"])) {
                if (($time_tmp = @DateTime::createFromFormat("Y-m-d H:i:s", @$_POST["date"])) === False) {
                    $fail_reasons[] = $translation["invalid_date"];
                } else {
                    $inputs["date"] = @$time_tmp->getTimestamp();
                }
            } else {
                $inputs["date"] = time();
            }
            $inputs["allow_comments"] = !(empty($_POST["allow_comments"]) or $_POST["allow_comments"] != "yes");
            try {
                $inputs["article_section"] = Section::by_name($_POST["section"]);
            } catch (DoesNotExistError $e) {
                $fail_reasons[] = $translation["unknown_section"];
            }
            $inputs["title"] = $_POST["title"];
            $inputs["content"] = $_POST["content"];
            $inputs["excerpt"] = $_POST["excerpt"];
            $inputs["tags"] = array_filter(array_map("trim", explode(",", $_POST["tags"])), function ($t) {
                return !empty($t);
            });
            if (isset($_POST["saveaslang"])) {
                $editlang = $_POST["saveaslang"];
            }
        } else {
            /* Call articleeditor plugins */
            $article = empty($article) ? NULL : Article::by_urlname($article);
            foreach ($articleeditor_plugins as $plugin) {
                call_user_func($plugin["fx"], $article, False);
            }
        }
        function fill_article(&$article, $inputs, $editlang)
        {
            $article->urlname = $inputs["urlname"];
开发者ID:ratatoeskr-cms,项目名称:ratatoeskr-cms,代码行数:67,代码来源:backend.php


注:本文中的Repository::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。