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


PHP Person::setLastname方法代码示例

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


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

示例1: 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();
     $names = array('Martin', 'Pedro', 'Lucas', 'Agustin', 'Cristian', 'Matias', 'Tomas', 'Cludio', 'Nancy', 'Emilia', 'Alejandra', 'Barbara', 'Luciana', 'Lucia', 'Belen', 'Natalia', 'Adriana', 'Patricio', 'Diego', 'Gonzalo', 'Juan', 'Pablo');
     $last_names = array('Ramirez', 'Rodriguez', 'Cordoba', 'Brown', 'Osorio', 'Diaz', 'Ayesa', 'Ramirez', 'Perez', 'Ripoll', 'Bottini', 'Ponce', 'Casella', 'Martinez', 'Erviti', 'Rodgriguez', 'Gonzalez', 'Fernandez', 'Benitez');
     $this->createContextInstance('backend');
     for ($i = 1; $i <= 100; $i++) {
         $person = new Person();
         $person->setLastname($last_names[rand(0, 18)]);
         $person->setFirstName($names[rand(0, 21)]);
         $person->setIdentificationType(1);
         $person->setIdentificationNumber($i);
         $person->setSex(rand(1, 2));
         $person->setBirthDate('2000-06-30');
         $student = new Student();
         $student->setGlobalFileNumber($i);
         $student->setPerson($person);
         $person->save();
         $student->save();
         $this->logSection("Person created", $person->__toString());
     }
     // add your code here
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:25,代码来源:createStudentsTask.class.php

示例2: createPersons

 private function createPersons()
 {
     $person = new Person();
     $person->drop()->yesImSure();
     $person->createTable();
     $persons = array(array('f' => 'Jane', 'l' => 'Wayne', 'zip' => 1003), array('f' => 'John', 'l' => 'Anderson', 'zip' => 1004), array('f' => 'Mike', 'l' => 'Johnson', 'zip' => 1005), array('f' => 'Katy', 'l' => 'Peterson', 'zip' => 1006));
     foreach ($persons as $person) {
         $p = new Person();
         $p->setFirstname($person['f']);
         $p->setLastname($person['l']);
         $p->setZip($person['zip']);
         $p->commit();
     }
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:14,代码来源:RequestHandlerTest.php

示例3: createPeople

 private function createPeople()
 {
     for ($i = 0; $i < 50; $i++) {
         $person = new Person();
         $person->setFirstname('John');
         $person->setLastname('Wayne');
         $person->setZip(4330);
         $person->setAddress('Somewhere');
         $person->commit();
     }
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:11,代码来源:LudoDBTreeCollectionTest.php

示例4: PDO

$pdo = new PDO(MIGRATION_DSN, MIGRATION_USER, MIGRATION_PASS);
$result = $pdo->query('select username,authenticationMethod,firstname,lastname from users u,people p where p.id=u.person_id');
foreach ($result->fetchAll(PDO::FETCH_ASSOC) as $row) {
    try {
        $person = new Person($row['username']);
    } catch (Exception $e) {
        // print_r($e);
        $person = new Person();
        $person->setUsername($row['username']);
        $person->setAuthenticationMethod($row['authenticationMethod']);
        $person->addRole('Staff');
        if ($row['authenticationMethod'] == 'LDAP') {
            try {
                $ldap = new LDAPEntry($person->getUsername());
                $person->setFirstname($ldap->getFirstname());
                $person->setLastname($ldap->getLastname());
                $person->setEmail($ldap->getEmail());
                // $person->setDepartment($ldap->getDepartment());
            } catch (Exception $e) {
                // print_r($e);
                $person->setEmail($row['username'] . '@bloomington.in.gov');
            }
        } else {
            $person->setFirstname($row['firstname']);
            $person->setLastname($row['lastname']);
        }
        try {
            $person->save();
        } catch (Exception $e) {
            print_r($e);
            print_r($person);
开发者ID:CodeForEindhoven,项目名称:uReport,代码行数:31,代码来源:2_users.php

示例5: executeConfirmStudent

 public function executeConfirmStudent(sfWebRequest $request)
 {
     sfContext::getInstance()->set("user", new FakeUser());
     //tomo las intancias de las librerias.
     $i_identification_type = BaseCustomOptionsHolder::getInstance('IdentificationType');
     $i_sex_type = BaseCustomOptionsHolder::getInstance('SexType');
     $i_nationality = BaseCustomOptionsHolder::getInstance('Nationality');
     $s_lastname = $this->getRequestParameter('apellido');
     // Es obligatorio
     $s_firstname = $this->getRequestParameter('nombres');
     // Es obligatorio
     $s_identification_type = $i_identification_type->getIdentificationType($this->getRequestParameter('tipo_documento_id'));
     $s_identification_number = $this->getRequestParameter('nro_documento');
     $s_sex = $i_sex_type->getSexType($this->getRequestParameter('sexo'));
     //Es obligatorio
     $s_phone = $this->getRequestParameter('telefono_fijo');
     $s_birthdate = $this->getRequestParameter('fecha_nacimiento');
     $s_birth_city = $this->getRequestParameter('ciudad_nacimiento_id');
     $s_health_coverage_id = $this->getRequestParameter('obra_social_id');
     $s_origin_school_id = $request->getParameter('escuela_procedencia_numero');
     //domicilio
     $s_city = $this->getRequestParameter('domicilio_ciudad_id');
     $s_street = $this->getRequestParameter('domicilio_calle');
     $s_number = $this->getRequestParameter('domicilio_numero');
     $s_floor = $this->getRequestParameter('domicilio_piso');
     $s_flat = $this->getRequestParameter('domicilio_departamento');
     //Chequeo tutor (madre)
     $m_identification_type = $i_identification_type->getIdentificationType($this->getRequestParameter('madre_tipo_documento_id'));
     $m_identification_number = $this->getRequestParameter('madre_nro_documento');
     $m_firstname = $this->getRequestParameter('madre_nombres');
     $m_lastname = $this->getRequestParameter('madre_apellido');
     $m_occupation = $this->getRequestParameter('madre_actividad_id');
     $m_occupation_category = $this->getRequestParameter('madre_ocupacion_id');
     $m_study = $this->getRequestParameter('madre_estudios_id');
     $m_email = $this->getRequestParameter('madre_email');
     $m_phone = $this->getRequestParameter('madre_telefono_celular');
     $m_birthdate = $this->getRequestParameter('madre_fecha_nacimiento');
     $m_birth_city = $this->getRequestParameter('madre_ciudad_nacimiento_id');
     $m_nationality = $i_nationality->getNationality($this->getRequestParameter('madre_nacionalidad_id'));
     $m_is_alive = $this->getRequestParameter('madre_vive');
     //chequeo is_alive
     if ($m_is_alive == 'S') {
         $m_is_alive = true;
     } elseif ($m_is_alive == 'N') {
         $m_is_alive = false;
     }
     //domicilio
     $m_city = $this->getRequestParameter('madre_domicilio_ciudad_id');
     $m_street = $this->getRequestParameter('madre_domicilio_calle');
     $m_number = $this->getRequestParameter('madre_domicilio_numero');
     $m_floor = $this->getRequestParameter('madre_domicilio_piso');
     $m_flat = $this->getRequestParameter('madre_domicilio_departamento');
     //Chequeo tutor (padre)
     $p_identification_type = $i_identification_type->getIdentificationType($this->getRequestParameter('padre_tipo_documento_id'));
     $p_identification_number = $this->getRequestParameter('padre_nro_documento');
     $p_firstname = $this->getRequestParameter('padre_nombres');
     $p_lastname = $this->getRequestParameter('padre_apellido');
     $p_occupation = $this->getRequestParameter('padre_actividad_id');
     $p_occupation_category = $this->getRequestParameter('padre_ocupacion_id');
     $p_study = $this->getRequestParameter('padre_estudios_id');
     $p_email = $this->getRequestParameter('padre_email');
     $p_phone = $this->getRequestParameter('padre_telefono_celular');
     $p_birthdate = $this->getRequestParameter('padre_fecha_nacimiento');
     $p_birth_city = $this->getRequestParameter('padre_ciudad_nacimiento_id');
     $p_nationality = $i_nationality->getNationality($this->getRequestParameter('padre_nacionalidad_id'));
     $p_is_alive = $this->getRequestParameter('padre_vive');
     //chequeo is_alive
     if ($p_is_alive == 'S') {
         $p_is_alive = true;
     } elseif ($p_is_alive == 'N') {
         $p_is_alive = false;
     }
     //domicilio
     $p_city = $this->getRequestParameter('padre_domicilio_ciudad_id');
     $p_street = $this->getRequestParameter('padre_domicilio_calle');
     $p_number = $this->getRequestParameter('padre_domicilio_numero');
     $p_floor = $this->getRequestParameter('padre_domicilio_piso');
     $p_flat = $this->getRequestParameter('padre_domicilio_departamento');
     $data = array();
     //chequeo campos obligatorios
     if (is_null($s_identification_type) || is_null($s_identification_number) || is_null($s_lastname) || trim($s_lastname) == "" || is_null($s_firstname) || trim($s_firstname) == "" || is_null($s_sex)) {
         throw new Exception('Missing data');
     } else {
         $con = Propel::getConnection();
         try {
             //chequeo que el alumno no haya sido ingresado en un año anterior (por lista de espera)
             $student = StudentPeer::retrieveByDocumentTypeAndNumber($s_identification_type, $s_identification_number);
             $con->beginTransaction();
             if (is_null($student)) {
                 //el alumno no existe. Creo la persona y el alumno
                 $s_person = new Person();
                 $s_person->setLastname($s_lastname);
                 $s_person->setFirstname($s_firstname);
                 $s_person->setSex($s_sex);
                 $s_person->setIdentificationType($s_identification_type);
                 $s_person->setIdentificationNumber($s_identification_number);
                 $s_person->setPhone($s_phone);
                 $s_person->setBirthdate($s_birthdate);
                 $s_person->setIsActive(true);
                 $s_person->setBirthCity($s_birth_city);
//.........这里部分代码省略.........
开发者ID:nvidela,项目名称:kimkelen,代码行数:101,代码来源:actions.class.php

示例6: PDO

/**
 * @copyright 2011 City of Bloomington, Indiana
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
 * @author Cliff Ingham <inghamn@bloomington.in.gov>
 */
include '../../../configuration.inc';
include './migrationConfig.inc';
$pdo = new PDO(MIGRATION_DSN, MIGRATION_USER, MIGRATION_PASS);
$sql = "select distinct\r\n\t\tfirstname,lastname,email,phone,address,city,state,zip\t\t\r\n\t\tfrom contacts";
$result = $pdo->query($sql);
foreach ($result->fetchAll(PDO::FETCH_ASSOC) as $row) {
    $person = new Person();
    $person->setFirstname(ucwords(strtolower($row['firstname'])));
    $person->setPhone($row['phone']);
    $person->setLastname(ucwords(strtolower($row['lastname'])));
    $person->setEmail($row['email']);
    if ($row['address'] && strtolower($row['city']) == 'bloomington') {
        $row['address'] = preg_replace('/[^a-zA-Z0-9\\-\\&\\s\'\\/]/', '', $row['address']);
        $url = new URL(ADDRESS_SERVICE . '/addresses/parse.php');
        $url->format = 'xml';
        $url->address = $row['address'];
        $parsed = new SimpleXMLElement($url, null, true);
        if ($parsed->street_number && $parsed->street_name) {
            // Look up their address in Master Address
            $url = new URL(ADDRESS_SERVICE . '/home.php');
            $url->queryType = 'address';
            $url->format = 'xml';
            $url->query = $row['address'];
            echo $url->query . " ==> ";
            $xml = new SimpleXMLElement($url, null, true);
开发者ID:CodeForEindhoven,项目名称:uReport,代码行数:30,代码来源:1_constituents.php

示例7: fopen

<?php

/**
 * @copyright 2011 City of Bloomington, Indiana
 * @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
 * @author Cliff Ingham <inghamn@bloomington.in.gov>
 */
include '../../../configuration.inc';
include './migrationConfig.inc';
include './categoryTranslation.inc';
$UNFOUND_PEOPLE = fopen('./unfoundPeople.log', 'w');
$unknownPerson = new Person();
$unknownPerson->setFirstname('unknown');
$unknownPerson->setLastname('person');
$unknownPerson->setUsername('unknown');
$unknownPerson->save();
$townships = array(1 => 'Bean Blossom', 2 => 'Benton', 3 => 'Bloomington', 4 => 'Clear Creek', 5 => 'Indian Creek', 6 => 'Perry', 7 => 'Van Buren', 9 => 'Richland', 10 => 'Polk', 11 => 'Washington', 12 => 'Salt Creek');
$pdo = new PDO(MIGRATION_DSN, MIGRATION_USER, MIGRATION_PASS);
$sql = "select c.*, t.comp_desc, i.username, i.needed, i.existing\n\t\tfrom ce_eng_comp c\n\t\tleft join c_types t on c.c_type=t.c_type1\n\t\tleft join inspectors i on c.inspector=i.inspector";
$result = $pdo->query($sql);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
    $location = "{$row['street_num']} {$row['street_dir']} {$row['street_name']} {$row['street_type']} {$row['sud_type']} {$row['sud_num']}";
    $location = preg_replace('/\\s+/', ' ', $location);
    echo "{$location} ==> ";
    // Import the Dates
    $ticket = new Ticket();
    if ($row['received']) {
        $ticket->setEnteredDate($row['received']);
    } else {
        continue;
    }
开发者ID:CodeForEindhoven,项目名称:uReport,代码行数:31,代码来源:6_tickets.php

示例8: shouldCreateRecordsInAcceptableTime_MYSQLI

 /**
  * @test
  */
 public function shouldCreateRecordsInAcceptableTime_MYSQLI()
 {
     LudoDB::setConnectionType('MYSQLI');
     $this->startTimer();
     for ($i = 0; $i < 500; $i++) {
         $person = new Person();
         $person->setFirstname('John');
         $person->setLastname('Wayne');
         $person->setAddress('Somewhere');
         $person->setZip(4330);
         $person->commit();
     }
     $time = $this->getElapsed(__FUNCTION__);
     // then
     $this->assertLessThan(1.5, $time);
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:19,代码来源:PerformanceTest.php

示例9: testSetLastnameProperty

 public function testSetLastnameProperty()
 {
     $res = $this->Person->setLastname('Doe');
     $this->assertSame($this->Person, $res);
     $this->assertSame('Doe', $this->Person->getLastname());
 }
开发者ID:crapougnax,项目名称:t41,代码行数:6,代码来源:PersonTest.php

示例10: PDO

include '../../../configuration.inc';
include './migrationConfig.inc';
$pdo = new PDO(MIGRATION_DSN, MIGRATION_USER, MIGRATION_PASS);
$result = $pdo->query('select distinct userid,full_name from complain_authorized');
foreach ($result->fetchAll(PDO::FETCH_ASSOC) as $row) {
    try {
        $person = new Person($row['userid']);
    } catch (Exception $e) {
        $person = new Person();
        $person->setUsername($row['userid']);
        $person->setAuthenticationMethod('LDAP');
        $person->addRole('Staff');
        try {
            $ldap = new LDAPEntry($person->getUsername());
            $person->setFirstname($ldap->getFirstname());
            $person->setLastname($ldap->getLastname());
            $person->setEmail($ldap->getEmail());
        } catch (Exception $e) {
            list($firstname, $lastname) = explode(' ', trim($row['full_name']));
            $person->setFirstname($firstname);
            $person->setLastname($lastname);
            $person->setEmail($row['userid'] . '@bloomington.in.gov');
        }
        try {
            $person->save();
        } catch (Exception $e) {
            print_r($e);
            print_r($person);
            exit;
        }
    }
开发者ID:CodeForEindhoven,项目名称:uReport,代码行数:31,代码来源:1_users.php

示例11: shouldBeAbleToDeleteColumnValue

 /**
  * @test
  */
 public function shouldBeAbleToDeleteColumnValue()
 {
     // given
     $person = new Person();
     $person->setFirstname('John');
     $person->setLastname('Wayne');
     $city = new City();
     $city->setZip('8642');
     $city->commit();
     $person->setZip('8642');
     $person->commit();
     $id = $person->getId();
     $this->assertEquals('John', $person->getFirstname(), 'Initial first name');
     $this->assertEquals('Wayne', $person->getLastname(), 'Initial last name');
     $person->setLastname(null);
     $person->commit();
     $secondId = $person->getId();
     $this->assertEquals($id, $secondId);
     // when
     $newPerson = new Person($person->getId());
     // then
     $this->assertNotNull($secondId);
     $this->assertNull($person->getUncommitted());
     $this->assertEquals('8642', $newPerson->getZip());
     $this->assertEquals('John', $newPerson->getFirstname());
     $this->assertNull($newPerson->getLastname());
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:30,代码来源:LudoDBModelTests.php


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