本文整理汇总了PHP中Configuration::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Configuration::getId方法的具体用法?PHP Configuration::getId怎么用?PHP Configuration::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration
的用法示例。
在下文中一共展示了Configuration::getId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processEdit
/**
* Process the form to edit an existing test session.
*
* @param sfWebRequest $request
* @param SessionForm $form
*/
protected function processEdit(sfWebRequest $request, SessionForm $form)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid()) {
$qa_generic = sfConfig::get("app_table_qa_generic");
// Get sent values and uploaded files
$values = $form->getValues();
$files = $request->getFiles();
// Retrieve values from form
$projectGroupId = $values["project_group_id"];
$projectId = $values["project"];
$productId = $values["product"];
// Get test environment and image names
$environmentForm = $form->getValue("environmentForm");
$imageForm = $form->getValue("imageForm");
// Create a new relationship between project group, project and product if needed
$projectToProductId = Doctrine_Core::getTable("ProjectToProduct")->getProjectToProductId($projectGroupId, $projectId, $productId);
if ($projectToProductId == null) {
$projectToProduct = new ProjectToProduct();
$projectToProduct->setProjectGroupId($projectGroupId);
$projectToProduct->setProjectId($projectId);
$projectToProduct->setProductId($productId);
$projectToProduct->save($conn);
$projectToProductId = $projectToProduct->getId();
}
// Create a new environment if needed
$environment = Doctrine_Core::getTable("TestEnvironment")->findByArray($environmentForm);
if ($environment == null) {
// Add new environment
$environment = new TestEnvironment();
$environment->setName($environmentForm["name"]);
$environment->setDescription($environmentForm["description"]);
$environment->setCpu($environmentForm["cpu"]);
$environment->setBoard($environmentForm["board"]);
$environment->setGpu($environmentForm["gpu"]);
$environment->setOtherHardware($environmentForm["other_hardware"]);
// Check if its slug does not already exist and generate a new one if needed
$slug = MiscUtils::slugify($environmentForm["name"]);
$size = 1;
while (Doctrine_Core::getTable("TestEnvironment")->checkSlug($slug)) {
$slug = MiscUtils::slugify($environmentForm["name"]) . substr(microtime(), -$size);
$size++;
}
$environment->setNameSlug($slug);
$environment->save($conn);
// Convert object into associative array
$environment = $environment->toArray();
}
// Create a new image if needed
$image = Doctrine_Core::getTable("Image")->findByArray($imageForm);
if ($image == null) {
// Add new image
$image = new Image();
$image->setName($imageForm["name"]);
$image->setDescription($imageForm["description"]);
$image->setOs($imageForm["os"]);
$image->setDistribution($imageForm["distribution"]);
$image->setVersion($imageForm["version"]);
$image->setKernel($imageForm["kernel"]);
$image->setArchitecture($imageForm["architecture"]);
$image->setOtherFw($imageForm["other_fw"]);
$image->setBinaryLink($imageForm["binary_link"]);
$image->setSourceLink($imageForm["source_link"]);
// Check if its slug does not already exist and generate a new one if needed
$slug = MiscUtils::slugify($imageForm["name"]);
$size = 1;
while (Doctrine_Core::getTable("Image")->checkSlug($slug)) {
$slug = MiscUtils::slugify($imageForm["name"]) . substr(microtime(), -$size);
$size++;
}
$image->setNameSlug(MiscUtils::slugify($slug));
$image->save($conn);
// Convert object into associative array
$image = $image->toArray();
}
// Create a new configuration relationship if needed
$configurationId = Doctrine_Core::getTable("Configuration")->getConfigurationId($projectToProductId, $environment["id"], $image["id"]);
if ($configurationId == null) {
$configuration = new Configuration();
$configuration->setProjectToProductId($projectToProductId);
$configuration->setTestEnvironmentId($environment["id"]);
$configuration->setImageId($image["id"]);
$configuration->save($conn);
$configurationId = $configuration->getId();
}
// Edit the session into DB
$testSession = Doctrine_Core::getTable("TestSession")->find($values["id"]);
$testSession->setId($values["id"]);
$testSession->setBuildId($values["build_id"]);
$testSession->setTestset($values["testset"]);
$testSession->setName($values["name"]);
$testSession->setTestObjective($values["test_objective"]);
$testSession->setQaSummary($values["qa_summary"]);
$testSession->setUserId($values["user_id"]);
//.........这里部分代码省略.........
示例2: executeImportRestApi
//.........这里部分代码省略.........
// If test_environment_name exists, retrieve id, else, create new entry and retrieve id
$query = "SELECT te.id AS test_environment_id\n\t\t\t\t\tFROM " . $qa_generic . ".test_environment te\n\t\t\t\t\tWHERE te.name = '" . $get_params['hwproduct'] . "'";
$result = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetch(PDO::FETCH_ASSOC);
if (empty($result["test_environment_id"])) {
// Check if creation of a new entry is allowed
if (sfConfig::get("app_rest_configuration_creation", false) == false) {
$conn->rollback();
$conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
echo "{\"ok\":\"0\",\"errors\":{\"test_environment\":\"Creation of new test environment is forbidden\"}}\n";
exit;
} else {
// Add new environment
$environment = new TestEnvironment();
$environment->setName($get_params['hwproduct']);
$environment->setNameSlug(MiscUtils::slugify($get_params['hwproduct']));
// Add hwproduct additional fields if given as parameters
if (isset($get_params['te_desc'])) {
$environment->setDescription($get_params['te_desc']);
}
if (isset($get_params['te_cpu'])) {
$environment->setCpu($get_params['te_cpu']);
}
if (isset($get_params['te_board'])) {
$environment->setBoard($get_params['te_board']);
}
if (isset($get_params['te_gpu'])) {
$environment->setGpu($get_params['te_gpu']);
}
if (isset($get_params['te_hw'])) {
$environment->setOtherHardware($get_params['te_hw']);
}
// Save new environment
$environment->save($conn);
$environmentId = $environment->getId();
}
} else {
$environmentId = $result["test_environment_id"];
}
// If image_name exists, retrieve id, else, create new entry and retrieve id
$query = "SELECT i.id AS image_id\n\t\t\t\t\tFROM " . $qa_generic . ".image i\n\t\t\t\t\tWHERE i.name = '" . $get_params['image'] . "'";
$result = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetch(PDO::FETCH_ASSOC);
if (empty($result["image_id"])) {
// Check if creation of a new entry is allowed
if (sfConfig::get("app_rest_configuration_creation", false) == false) {
$conn->rollback();
$conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
echo "{\"ok\":\"0\",\"errors\":{\"image\":\"Creation of new image is forbidden\"}}\n";
exit;
} else {
// Add new image
$image = new Image();
$image->setName($get_params['image']);
$image->setNameSlug(MiscUtils::slugify($get_params['image']));
// Add image additional fields if given as parameters
if (isset($get_params['img_desc'])) {
$image->setDescription($get_params['img_desc']);
}
if (isset($get_params['img_os'])) {
$image->setOs($get_params['img_os']);
}
if (isset($get_params['img_dist'])) {
$image->setDistribution($get_params['img_dist']);
}
if (isset($get_params['img_vers'])) {
$image->setVersion($get_params['img_vers']);
}
示例3: prune
/**
* Exclude object from result
*
* @param Configuration $configuration Object to remove from the list of results
*
* @return ConfigurationQuery The current query, for fluid interface
*/
public function prune($configuration = null)
{
if ($configuration) {
$this->addUsingAlias(ConfigurationPeer::ID, $configuration->getId(), Criteria::NOT_EQUAL);
}
return $this;
}