本文整理汇总了PHP中Project::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::setName方法的具体用法?PHP Project::setName怎么用?PHP Project::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::setName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testIfSessionCanAddEntity
public function testIfSessionCanAddEntity()
{
$project = new Project();
$project->setName('My Project');
$this->session->addEntity($project);
$this->assertTrue($this->session->isAdded($project));
}
示例2: testTpConfig
public function testTpConfig()
{
$project = new Project();
$project->setName('name');
$project->setDescription('description');
$project->setKeywords(['k1', 'k2']);
$project->setHomepage('http://homepage.com');
$project->addAuthor(new Author('author-name <author@email.com>'));
$project->addPackage($this->buildPackage('namespace1', ['path1.1', 'path1.2']));
$this->assertSame(['name' => 'name', 'description' => 'description', 'keywords' => ['k1', 'k2'], 'homepage' => 'http://homepage.com', 'authors' => [['name' => 'author-name', 'email' => 'author@email.com']], 'autoload' => ['psr-4' => ['namespace1\\' => ['path1.1', 'path1.2']]]], $project->toConfig());
}
示例3: executeCreate
public function executeCreate(sfWebRequest $request)
{
$name = $request->getParameter("name");
if (strlen($name) > 1 && strlen($name) < 45) {
$p = new Project();
$p->setName($name);
$p->save();
} else {
$this->forward404("The project name is to long!");
}
$this->executeList($request);
$this->setLayout("list");
}
示例4: executeUpdate
public function executeUpdate()
{
$jira = new sfJiraPlugin($this->getUser()->getProfile()->getJiraLogin(), $this->getUser()->getProfile()->getJiraPassword());
$aProjects = $jira->getProjects();
foreach ($aProjects as $project) {
#var_dump( $project );
$c = new Criteria();
$c->add(ProjectPeer::USER_ID, $this->getUser()->getProfile()->getId());
$c->add(ProjectPeer::KEY, $project->key);
$p = ProjectPeer::doSelectOne($c);
$c = new Criteria();
$c->add(UserPeer::JIRA_LOGIN, $project->lead);
$u = UserPeer::doSelectOne($c);
if (empty($p)) {
$p = new Project();
$p->setKey($project->key);
$p->setLeadId(!empty($u) ? $u->getId() : null);
$p->setUserId($this->getUser()->getProfile()->getId());
$p->setName($project->name);
$p->setUpdated(date('r'));
$p->save();
}
$issues = $jira->getIssuesForProject($p->getKey());
foreach ($issues as $issue) {
#die($p->getKey());
if ($issue->assignee == $this->getUser()->getProfile()->getJiraLogin()) {
$c = new Criteria();
$c->add(TaskPeer::KEY, $issue->key);
$t = TaskPeer::doSelectOne($c);
if (empty($t)) {
$c = new Criteria();
$c->add(UserPeer::JIRA_LOGIN, $issue->reporter);
$u = UserPeer::doSelectOne($c);
$t = new Task();
$t->setProjectId($p->getId());
$t->setTitle($issue->summary);
$t->setDescription($issue->description);
$t->setKey($issue->key);
$t->setUpdated(date('r'));
$t->setStatusId($issue->status);
$t->setPriorityId($issue->priority);
$t->setLeadId(!empty($u) ? $u->getId() : null);
$t->save();
}
}
}
}
$this->redirect('@homepage');
return sfView::NONE;
}
示例5: testMap
function testMap()
{
$outlet = Outlet::getInstance();
$p = new Project();
$p->setName('Project 1');
$outlet->save($p);
$p_map = $outlet->select('Project', 'where {Project.ProjectID} = ?', array($p->getProjectID()));
$p_map = $p_map[0];
$this->assertTrue($p === $p_map, 'Diferent object on identity map');
$outlet->clearCache();
$p_map = $outlet->select('Project', 'where {Project.ProjectID} = ?', array($p->getProjectID()));
$p_map = $p_map[0];
$this->assertTrue($p !== $p_map, 'Equal object on identity map');
}
示例6: testUpdateAfterRelationshipUpdate
function testUpdateAfterRelationshipUpdate()
{
$outlet = Outlet::getInstance();
$p = new Project();
$p->setName('Name 1');
$b = new Bug();
$b->Title = 'Test Bug';
$p->addBug($b);
$outlet->save($p);
$projectid = $p->getProjectID();
$p->setName('Name 2');
$outlet->save($p);
$p = $outlet->load('Project', $projectid);
$this->assertEquals($p->getName(), 'Name 2');
}
示例7: processCreate
protected function processCreate(sfWebRequest $request, ProjectFormCustom $form)
{
$form->bind($request->getParameter($form->getName()));
if ($form->isValid()) {
$values = $form->getValues();
// Slugify name, and check if slug generated does not already exist and generate a new one if needed
if (empty($values['name_slug'])) {
$slug = MiscUtils::slugify($values['name']);
} else {
$slug = $values['name_slug'];
}
$size = 1;
while (Doctrine_Core::getTable("Project")->checkSlugForProject(NULL, $slug, true)) {
$slug = MiscUtils::slugify($values['name']) . substr(microtime(), -$size);
$size++;
}
// Create the project into database
$projectObject = new Project();
$projectObject->setName($values['name']);
$projectObject->setDescription($values['description']);
$projectObject->setUserId($values['user_id']);
$projectObject->setCreatedAt($values['created_at']);
$projectObject->setStatus($values['status']);
$projectObject->setSecurityLevel($values['security_level']);
$projectObject->setNameSlug($slug);
$projectObject->save();
// Get the project's id
$projectId = $projectObject->getId();
// Create a new relationship between projects, products and project groups for each checked form's product
foreach ($values['product'] as $product) {
$ptpObject = new ProjectToProduct();
$ptpObject->setProjectGroupId($values['group']);
$ptpObject->setProjectId($projectId);
$ptpObject->setProductId($product);
$ptpObject->save();
}
if ($request->hasParameter('_save_and_add')) {
$this->getUser()->setFlash('notice', $notice . ' You can add another one below.');
$this->redirect('@project_new');
} else {
$this->getUser()->setFlash('notice', $notice);
$this->redirect(array('sf_route' => 'project_edit', 'sf_subject' => $projectObject));
}
} else {
$this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
}
}
示例8: addProject
function addProject()
{
$response = new Response();
try {
$projectName = $this->input->post("project-name");
$subdivision = $this->input->post("sub-division");
$budget = $this->input->post("project-budget");
$schemeId = $this->input->post("scheme");
$project = new Project();
$project->setCreated(new DateTime());
$project->setName($projectName);
$project->setStatus(Project::PROJECT_ADMIN_APPROVAL);
$project->setBudget($budget);
$project->setScheme($this->findById("Scheme", $schemeId));
$subdivision = $this->findById("Subdivision", $subdivision);
$project->setSubDivision($subdivision);
$this->save($project);
} catch (Exception $e) {
$response->setStatus(false);
$response->setErrorMessage($e->getMessage());
}
$this->output->set_content_type('application/json')->set_output(json_encode($response));
}
示例9: testsperengine
//.........这里部分代码省略.........
SmartTest::instance()->progress();
} catch (Exception $e) {
die("<b style='color:red'>Error CANNOT:" . SmartTest::instance()->canwe);
}
//reserved
SmartTest::instance()->progress();
SmartTest::instance()->canwe = "generate classes using Redbean?";
if (!class_exists("Bug")) {
$i += RedBean_OODB::gen("Bug");
if ($i !== 4) {
die("<b style='color:red'>Error CANNOT {$i}:" . SmartTest::instance()->canwe);
}
} else {
if ($i !== 3) {
die("<b style='color:red'>Error CANNOT {$i}:" . SmartTest::instance()->canwe);
}
}
if (!class_exists("Bug")) {
die("<b style='color:red'>Error CANNOT:" . SmartTest::instance()->canwe);
}
SmartTest::instance()->progress();
SmartTest::instance()->canwe = "use getters and setters";
$bug = new Bug();
$bug->setSomething(sha1("abc"));
if ($bug->getSomething() != sha1("abc")) {
die("<b style='color:red'>Error CANNOT:" . SmartTest::instance()->canwe);
}
//can we use non existing props? --triggers fatal..
$bug->getHappy();
SmartTest::instance()->progress();
SmartTest::instance()->canwe = "use oget and oset?";
RedBean_OODB::gen("Project");
$proj = new Project();
$proj->setName("zomaar");
$bug->osetProject($proj);
$bug->save();
$oldbug = new Bug(1);
$oldproj = $oldbug->ogetProject();
if ($oldproj->getName() != "zomaar") {
die("<b style='color:red'>Error CANNOT:" . SmartTest::instance()->canwe);
}
SmartTest::instance()->progress();
SmartTest::instance()->canwe = "Use boolean values and retrieve them with is()?";
if ($bug->isHappy()) {
die("<b style='color:red'>Error CANNOT:" . SmartTest::instance()->canwe);
}
SmartTest::instance()->progress();
$bug->setHappy(true);
$bug->save();
$bug = new Bug(1);
if (!$bug->isHappy()) {
die("<b style='color:red'>Error CANNOT:" . SmartTest::instance()->canwe);
}
SmartTest::instance()->progress();
$bug->setHappy(false);
if ($bug->isHappy()) {
die("<b style='color:red'>Error CANNOT:" . SmartTest::instance()->canwe);
}
SmartTest::instance()->progress();
SmartTest::instance()->canwe = "break oget/oset assoc?";
$bug->osetProject(null);
$bug->save();
$bug = null;
$bug = new Bug(1);
$proj = $bug->ogetProject();
if ($proj->getID() > 0) {
示例10: testDbFunctions
function testDbFunctions()
{
$outlet = Outlet::getInstance();
$p1 = new Project();
$p1->setName('AAAA');
$outlet->save($p1);
$p2 = new Project();
$p2->setName('BBBB');
$outlet->save($p2);
$stmt = $outlet->query('SELECT MAX({p.Name}) as max_project FROM {Project p}');
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
$this->assertEquals($data[0]['max_project'], 'BBBB');
}
示例11: executeSaveProject
/**
* Save Customer
* @param sfWebRequest $request
* @return unknown_type
*/
public function executeSaveProject(sfWebRequest $request)
{
$projectService = new ProjectService();
if ($request->isMethod('post')) {
$project = new Project();
$project->setCustomerId($request->getParameter('cmbCustomerId'));
$project->setName($request->getParameter('txtName'));
$project->setDescription($request->getParameter('txtDescription'));
$projectService->saveProject($project);
$this->setMessage('SUCCESS', array(TopLevelMessages::SAVE_SUCCESS));
$this->redirect('admin/listProject');
}
$customerService = new CustomerService();
$this->listCustomer = $customerService->getCustomerList();
}
示例12: find
function find($criteria = null, $order = null, $limit = 1000, $from = 0)
{
$result = $this->database->query($this->buildFindQuery($criteria, $order, $limit, $from));
if (!is_null($result->getError())) {
return $result->getError();
}
$projects = array();
while ($row = $result->fetchRow()) {
$project = new Project();
$value = $row[0];
$project->setId($value);
$value = $row[1];
$project->setName($value);
$value = $row[2];
$project->setDescription($value);
$value = $row[3];
$value = $this->database->toBoolean($value);
$project->setMove_more($value);
$value = $row[4];
$project->setCampaign($value);
$value = $row[5];
$project->setSuspending($value);
$value = $row[6];
$project->setEnding($value);
$value = $row[7];
$project->setOwner($value);
$value = $row[8];
$project->setCruid($value);
$value = $row[9];
$project->setPkey($value);
$value = $row[10];
$project->setRsskey($value);
$value = $row[11];
$project->setR_date($value);
$value = $row[12];
$project->setR_user($value);
if ($order != null) {
array_push($projects, $project);
} else {
$projects[$project->getId()] = $project;
}
}
return $projects;
}
示例13: setName
public function setName($name)
{
$this->__load();
return parent::setName($name);
}
示例14: add
public function add($name)
{
$this->view = null;
try {
$user = User::find(Session::uid());
if (!$user->getId() || !$user->getIs_admin()) {
throw new Exception('Action not allowed.');
}
if (!preg_match('/^\\d*[-a-zA-Z][-a-zA-Z0-9]*$/', $name)) {
throw new Exception('The name of the project can only contain alphanumeric characters plus dashes and must have 1 alpha character at least');
}
try {
$project = Project::find($name);
} catch (Exception $e) {
}
if (is_object($project) && $project->getProjectId($name)) {
throw new Exception('Project with the same name already exists!');
}
$file = new File();
$logo = '';
if (!empty($_POST['logo'])) {
$file->findFileById($_POST['logo']);
$logo = basename($file->getUrl());
}
$project = new Project();
$project->setName($name);
$project->setDescription($_POST['description']);
$project->setWebsite($_POST['website']);
$project->setContactInfo($user->getUsername());
$project->setOwnerId($user->getId());
$project->setActive(true);
$project->setInternal(true);
$project->setRequireSandbox(true);
$project->setLogo($logo);
$project->setRepo_type('git');
$project->setRepository($_POST['github_repo_url']);
$project->setGithubId($_POST['github_client_id']);
$project->setGithubSecret($_POST['github_client_secret']);
$project->save();
if ($file->getId()) {
$file->setProjectId($project->getProjectId());
$file->save();
}
$journal_message = '@' . $user->getNickname() . ' added project *' . $name . '*';
Utils::systemNotification($journal_message);
echo json_encode(array('success' => true, 'message' => $journal_message));
} catch (Exception $e) {
$error = $e->getMessage();
echo json_encode(array('success' => false, 'message' => $error));
}
}
示例15: initActiveProject
/**
* Init active project, if we have active_project $_GET var
*
* @access public
* @param void
* @return null
* @throws Error
*/
private function initActiveProject()
{
trace(__FILE__, 'initActiveProject()');
$project_id = array_var($_GET, 'active_project');
if (!empty($project_id)) {
$project = Projects::findById($project_id);
if ($project instanceof Project) {
$this->setProject($project);
} else {
$project = new Project();
$project->setId($project_id);
$project->setName(lang('deleted or unknown'));
//flash_error(lang('failed to load project'));
$this->setProject($project);
//throw new Error(lang('failed to load project'));
}
// if
}
// if
}