本文整理汇总了PHP中Division::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Division::setName方法的具体用法?PHP Division::setName怎么用?PHP Division::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Division
的用法示例。
在下文中一共展示了Division::setName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createByName
public function createByName($name)
{
print_r('[' . $name . ']');
$document = new Division();
$document->setName($name);
$document->setSlug();
$document->save();
$document = $this->findOneBySlug($document->getSlug());
return $document;
}
示例2: execute
protected function execute($arguments = array(), $options = array())
{
// initialize the database connection
$databaseManager = new sfDatabaseManager($this->configuration);
$connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
// add your code here
$courses = CoursePeer::doSelect(new Criteria());
foreach ($courses as $course) {
$division = new Division();
$division->setName($course->getName());
$division->setSchoolYearId($course->getSchoolYearId());
foreach ($course->getCourseSubjects() as $course_subject) {
$course_students = $course->getCourseStudents();
if (isset($course_students[0])) {
$division->setCareerId($course_students[0]->getCareerSubject()->getCareerId());
} else {
$division->setCareerId(1);
}
$new_course = new Course();
$course->copyInto($new_course);
$new_course->setName($course_subject->getSubject() . ' - ' . $course->getName());
$new_course->save();
$new_course_subject = new CourseSubject();
$course_subject->copyInto($new_course_subject);
$new_course_subject->setCourseId($new_course->getId());
$new_course_subject->setCourseId($new_course->getId());
$new_course_subject->save();
$course_subject->delete();
$c = new Criteria();
$c->add(CourseStudentPeer::COURSE_ID, $course->getId());
$c->addJoin(CourseStudentPeer::CAREER_SUBJECT_ID, CareerSubjectPeer::ID);
$c->add(CareerSubjectPeer::SUBJECT_ID, $new_course_subject->getSubjectId());
$course_students = CourseStudentPeer::doSelect($c);
foreach ($course_students as $course_student) {
$new_course_student = new CourseStudent();
$course_student->copyInto($new_course_student);
$new_course_student->setCourseId($new_course->getId());
$new_course_student->save();
$course_student->delete();
}
$division_course = new DivisionCourse();
$division_course->setCourse($new_course);
$division->addDivisionCourse($division_course);
}
try {
$course->delete();
} catch (Exception $e) {
}
try {
$division->save();
} catch (Exception $e) {
}
$this->logSection('division+', 'Division ' . $division . ' created');
}
}
示例3: setName
public function setName($name)
{
$this->__load();
return parent::setName($name);
}
示例4: initDivision
function initDivision()
{
$division = new Division();
$division->setName("Sindhudurg");
$sub1 = new Subdivision();
$sub1->setName("Devgad");
$sub1->setDivision($division);
$sub2 = new Subdivision();
$sub2->setName("Vaibhavvadi");
$sub2->setDivision($division);
$sub3 = new Subdivision();
$sub3->setName("Malwan");
$sub3->setDivision($division);
$sub4 = new Subdivision();
$sub4->setName("Kudal");
$sub4->setDivision($division);
$sub5 = new Subdivision();
$sub5->setName("Vengurla");
$sub5->setDivision($division);
$sub6 = new Subdivision();
$sub6->setName("Sawantwadi");
$sub6->setDivision($division);
$sub7 = new Subdivision();
$sub7->setName("Dodamarg");
$sub7->setDivision($division);
$division->getSubdivisions()->add($sub1);
$division->getSubdivisions()->add($sub2);
$division->getSubdivisions()->add($sub3);
$division->getSubdivisions()->add($sub4);
$division->getSubdivisions()->add($sub5);
$division->getSubdivisions()->add($sub6);
$division->getSubdivisions()->add($sub7);
$this->em->persist($division);
$this->em->flush();
echo "Locations Created..";
}