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


PHP Person::delete方法代码示例

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


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

示例1: deleteAction

 public function deleteAction()
 {
     if (!$this->hasACL('edit_people')) {
         $this->doNoAccessError();
     }
     $status = ValidationContainer::instance();
     $id = $this->getSanParam('id');
     if ($id and !Person::isReferenced($id)) {
         $trainer = new Trainer();
         $rows = $trainer->find($id);
         $row = $rows->current();
         if ($row) {
             $trainer->delete('person_id = ' . $row->person_id);
         }
         $person = new Person();
         $rows = $person->find($id);
         $row = $rows->current();
         if ($row) {
             $person->delete('id = ' . $row->id);
         }
         $status->setStatusMessage(t('That person was deleted.'));
     } else {
         if (!$id) {
             $status->setStatusMessage(t('That person could not be found.'));
         } else {
             $status->setStatusMessage(t('That person is an active') . ' ' . t('participant') . ' ' . t('or') . ' ' . t('trainer') . ' ' . t('and could not be deleted.'));
         }
     }
     //validate
     $this->view->assign('status', $status);
 }
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:31,代码来源:PersonController.php

示例2: delete

 public function delete()
 {
     try {
         $model = new Person($this->data->id);
         $model->delete();
         $go = "!\$('#formObject_dialog').dialog('close');";
         $this->renderPrompt('information', _M("Record [%s] removed.", $model->getDescription()), $go);
     } catch (\Exception $e) {
         $this->renderPrompt('error', _M("Deletion denied."));
     }
 }
开发者ID:elymatos,项目名称:expressive_fnbr,代码行数:11,代码来源:AnnoStatusController.php

示例3: delete

 function delete($supplier_id)
 {
     $success = false;
     //Run these queries as a transaction, we want to make sure we do all or nothing
     $this->db->trans_start();
     //delete from customers table
     if ($this->db->delete('suppliers', array('person_id' => $supplier_id))) {
         //delete from Person table
         $success = parent::delete($supplier_id);
     }
     $this->db->trans_complete();
     return $success;
 }
开发者ID:MaizerGomes,项目名称:PHP-Point-Of-Sale,代码行数:13,代码来源:supplier.php

示例4: testDeleteCriteria

 public function testDeleteCriteria()
 {
     $this->prepareDB(true);
     $oDriver = DBDriver::get_instance('sqlite', array('filename' => dirname(__FILE__) . '/unittest.db'));
     $mRes = Person::delete('Person')->where('lastName', 'Piochet')->exec($oDriver);
     $mRes = Person::select('Person')->where('lastName', 'Piochet')->exec($oDriver);
     $this->assertEquals(0, $mRes->numRows());
 }
开发者ID:poitch,项目名称:dokin,代码行数:8,代码来源:SQLiteTest.php

示例5: delete_person

 public function delete_person($person_id = NULL)
 {
     if (is_null($person_id)) {
         add_error_flash_message('Osoba sa nenašla.');
         redirect(site_url('persons'));
     }
     $person = new Person();
     $person->get_by_id((int) $person_id);
     if (!$person->exists()) {
         add_error_flash_message('Osoba sa nenašla.');
         redirect(site_url('persons'));
     }
     if ($person->id == auth_get_id()) {
         add_error_flash_message('Nemôžete vymazať vlastný účet.');
         redirect(site_url('persons'));
     }
     $success_message = 'Osoba <strong>' . $person->name . ' ' . $person->surname . '</strong> s loginom <strong>' . $person->login . '</strong>, a s ID <strong>' . $person->id . '</strong> bola úspešne vymazaná.';
     $error_message = 'Osobu <strong>' . $person->name . ' ' . $person->surname . '</strong> s loginom <strong>' . $person->login . '</strong>, a s ID <strong>' . $person->id . '</strong> sa nepodarilo vymazať.';
     if ($person->delete()) {
         unlink_recursive('user/photos/data/' . (int) $person_id . '/', TRUE);
         add_success_flash_message($success_message);
     } else {
         add_error_flash_message($error_message);
     }
     redirect(site_url('persons'));
 }
开发者ID:andrejjursa,项目名称:lstme-ledcoin,代码行数:26,代码来源:persons.php

示例6:

<?php

//
require_once 'common.php';
//
use Javanile\SchemaDB\Storable;
//
class Person extends Storable
{
    //
    public $id = self::PRIMARY_KEY;
    //
    public $name = "";
    //
    public $age = 0;
}
// remove Person table and complete items list
Person::drop('confirm');
// import Persons from array-of-array
Person::import([['name' => 'Francesco', 'age' => 10], ['name' => 'Paolo', 'age' => 12], ['name' => 'Piero', 'age' => 10], ['name' => 'Antonio', 'age' => 13]]);
// printout table record before delete
Person::dump();
// delete Person with 10 years old
Person::delete(['age' => 10]);
// printout table record after delete
Person::dump();
开发者ID:javanile,项目名称:schemadb,代码行数:26,代码来源:004-import.php

示例7: testDeleteMultiple

 public function testDeleteMultiple()
 {
     $oDriver = DBDriver::get_instance('mongo');
     // Clean up database
     Person::delete('Person')->where('firstName', 'Jerome')->exec($oDriver);
     $iCount = 10;
     for ($i = 0; $i < $iCount; $i++) {
         $oPerson = new Person();
         $oPerson->firstName = 'Jerome';
         $oPerson->lastName = 'Poichet';
         $mRes = $oPerson->insert()->exec($oDriver);
     }
     $oRes = Person::select('Person')->where('firstName', 'Jerome')->exec($oDriver);
     $this->assertEquals($iCount, $oRes->numRows());
     Person::delete('Person')->where('firstName', 'Jerome')->exec($oDriver);
     $oRes = Person::select('Person')->where('firstName', 'Jerome')->exec($oDriver);
     $this->assertEquals(0, $oRes->numRows());
 }
开发者ID:poitch,项目名称:dokin,代码行数:18,代码来源:MongoTest.php

示例8: SchemaDB

}
//
require_once '../data.php';
//
require_once '../../SchemaDB.php';
//
use SourceForge\SchemaDB\SchemaDB;
//
use SourceForge\SchemaDB\Storable;
//
new SchemaDB(array('host' => $host, 'user' => $user, 'pass' => $pass, 'name' => $name, 'pref' => $pref));
//
class Person extends Storable
{
    //
    public $id = self::PRIMARY_KEY;
    //
    public $name = "";
    //
    public $age = 0;
}
// remove Person table and complete items list
Person::drop('confirm');
// import Persons from array-of-array
Person::import(array(array('name' => 'Francesco', 'age' => 10), array('name' => 'Paolo', 'age' => 12), array('name' => 'Piero', 'age' => 10), array('name' => 'Antonio', 'age' => 13)));
// printout table record before delete
Person::dump();
// delete Person with 10 years old
Person::delete(array('age' => 10));
// printout table record after delete
Person::dump();
开发者ID:javanile,项目名称:schemadb,代码行数:31,代码来源:delete.php

示例9: testDelete

 public function testDelete()
 {
     $person = new Person();
     $person->setPersonKindID(1);
     $person->setUsername("timmy");
     $person->setName("Timothy");
     $person->setPhone("000-101-1010");
     $person->save();
     $this->assertTrue(Person::personExists($person->getUsername()) != false);
     $person->delete();
     $this->assertTrue(!Person::personExists($person->getUsername()));
 }
开发者ID:JakeDawkins,项目名称:NiceCatch,代码行数:12,代码来源:personTest.php

示例10: testDeleteBypassTrash

 public function testDeleteBypassTrash()
 {
     // Cleanup
     Person::deleteAll();
     // Insert
     $person = new Person();
     $person->first_name = 'John';
     $person->last_name = 'Doe';
     $person->email = 'johndoe@test.com';
     $person->post_title = 'John Doe';
     $post_id = $person->save();
     // Delete to trash
     $person = new Person();
     $this->assertTrue($person->load($post_id));
     $this->assertTrue(is_object($person->delete(true)));
     // Load shouldn't work
     $person = new Person();
     $this->assertFalse($person->load($post_id));
 }
开发者ID:tacowordpress,项目名称:tacowordpress,代码行数:19,代码来源:PostTest.php

示例11: delete

 function delete($employee_id)
 {
     $success = false;
     //Don't let employee delete their self
     if ($employee_id == $this->get_logged_in_employee_info()->person_id) {
         return false;
     }
     //Run these queries as a transaction, we want to make sure we do all or nothing
     $this->db->trans_start();
     //Delete permissions
     if ($this->db->delete('permissions', array('person_id' => $employee_id))) {
         //delete from employee table
         if ($this->db->delete('employees', array('person_id' => $employee_id))) {
             //delete from person table
             $success = parent::delete($employee_id);
         }
     }
     $this->db->trans_complete();
     return $success;
 }
开发者ID:MaizerGomes,项目名称:PHP-Point-Of-Sale,代码行数:20,代码来源:employee.php

示例12: shouldBeAbleToDeleteRecord

 /**
  * @test
  */
 public function shouldBeAbleToDeleteRecord()
 {
     // given
     $p = new Person();
     $p->setFirstname('John');
     $p->commit();
     // when
     $p2 = new Person($p->getId());
     $id = $p2->getId();
     $p2->delete();
     $p3 = new Person($p->getId());
     // then
     $this->assertEquals(null, $p2->getId());
     $this->assertEquals(null, $p3->getId());
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:18,代码来源:LudoDBModelTests.php

示例13: Person

$p->save();
$p = new Person();
$p->firstname = "John";
$p->lastname = "Smith";
$p->save();
$p = new Person();
$p->firstname = "Jane";
$p->lastname = "Doe";
$p->save();
$p = new Person();
$p->firstname = "Barney";
$p->lastname = "Riff";
$p->save();
$p = new Person();
$p->firstname = "Jerry";
$p->lastname = "Calabria";
$p->save();
dbm_debug('Heading', 'Done creating entries');
displayEveryone();
dbm_debug('Heading', 'Deleting the entry with ID=4');
$p = new Person(4);
$p->delete();
displayEveryone();
dbm_debug('Heading', 'Deleting the Smiths');
$p = new Person();
$p->deleteByLastName("Smith");
displayEveryone();
dbm_debug('Heading', 'Deleting all entries');
$p = new Person();
$p->deleteAll();
displayEveryone();
开发者ID:rmbwebs,项目名称:amortize,代码行数:31,代码来源:test_deleting.php


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