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


PHP Author::delete方法代码示例

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


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

示例1: testUpdate

 /** <tt>update test</tt> */
 public function testUpdate()
 {
     $item = new Author();
     $item->name = 'Andrei Cristescu';
     $this->assertEqual($item->insert(), $item->id);
     $item->email = 'cristescu@yahoo.com';
     $this->assertEqual($item->update(), 1);
     $this->assertEqual($item->delete(), 1);
 }
开发者ID:BackupTheBerlios,项目名称:medick-svn,代码行数:10,代码来源:DBOperationsTest.php

示例2: testDelete

 function testDelete()
 {
     $name = "Stephen King";
     $test_author = new Author($name);
     $test_author->save();
     $name2 = "Neal Stephenson";
     $test_author2 = new Author($name2);
     $test_author2->save();
     $test_author->delete();
     $this->assertEquals([$test_author2], Author::getAll());
 }
开发者ID:umamiMike,项目名称:Library,代码行数:11,代码来源:AuthorTest.php

示例3: Author

 function test_delete()
 {
     $name = "Jerry Garcia";
     $test_author = new Author($name);
     $test_author->save();
     $name2 = "Frank Sinatra";
     $test_author2 = new Author($name2);
     $test_author2->save();
     $test_author->delete();
     $result = Author::getAll();
     $this->assertEquals([$test_author2], $result);
 }
开发者ID:nathanhwyoung,项目名称:Library-2,代码行数:12,代码来源:AuthorTest.php

示例4: Author

 function test_delete()
 {
     //Arrange
     $author_name = "Jack London";
     $test_author = new Author($author_name);
     $test_author->save();
     $author_name2 = "Robert Jordan";
     $test_author2 = new Author($author_name2);
     $test_author2->save();
     //Act
     $test_author2->delete();
     $result = Author::getAll();
     //Assert
     $this->assertEquals([$test_author], $result);
 }
开发者ID:jlbethel,项目名称:Library,代码行数:15,代码来源:AuthorTest.php

示例5: testDeleteAuthor

 function testDeleteAuthor()
 {
     //Arrange
     $id = null;
     $name = "Lemony Snicket";
     $test_book = new Book($id, $name);
     $test_book->save();
     $name2 = "J.R.R. Tolkien";
     $test_author = new Author($id, $name2);
     $test_author->save();
     //Act
     $test_author->addBook($test_book);
     $test_author->delete();
     //Assert
     $this->assertEquals([], $test_book->getAuthors());
 }
开发者ID:kellimargaret,项目名称:2015.08.26.Library,代码行数:16,代码来源:AuthorTest.php

示例6: testDelete

 function testDelete()
 {
     //Arrange
     $author_name = "Frank Herbert";
     $id = null;
     $test_author = new Author($author_name, $id);
     $test_author->save();
     $author_name2 = "Neal Stephenson";
     $id2 = null;
     $test_author2 = new Author($author_name2, $id2);
     $test_author2->save();
     //Act
     $test_author->delete();
     //Assert
     $this->assertEquals([$test_author2], Author::getAll());
 }
开发者ID:juliocesardiaz,项目名称:library-1,代码行数:16,代码来源:AuthorTest.php

示例7: Author

 function test_delete()
 {
     //Arrange
     $name = "Kurt Vonnegut";
     $test_author = new Author($name);
     $test_author->save();
     //Act
     $test_author->delete();
     $result = Author::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
开发者ID:kevintokheim,项目名称:Library,代码行数:12,代码来源:AuthorTest.php

示例8: Author

 function test_delete()
 {
     //Arrange
     $name = "J.K. Rowling";
     $test_author = new Author($name);
     $test_author->save();
     $name2 = "C.S. Lewis";
     $test_author2 = new Author($name2);
     $test_author2->save();
     //Act
     $test_author->delete();
     $result = Author::getAll();
     //Assert
     $this->assertEquals($test_author2, $result[0]);
 }
开发者ID:kellimargaret,项目名称:Library-Search,代码行数:15,代码来源:AuthorTest.php

示例9: testDelete

 function testDelete()
 {
     //Arrange
     $name = "Nathan Young";
     $id = null;
     $test_author = new Author($name, $id);
     $test_author->save();
     $name2 = "Kyle Pratuch";
     $test_author2 = new Author($name2, $id);
     $test_author2->save();
     //Act
     $test_author->delete();
     //
     $this->assertEquals([$test_author2], Author::getAll());
 }
开发者ID:nathanhwyoung,项目名称:Library,代码行数:15,代码来源:AuthorTest.php

示例10: testDelete

 function testDelete()
 {
     //Arrange
     $title = "Harry Potter";
     $id = 1;
     $test_book = new Book($title, $id);
     $test_book->save();
     $name = "JK Rowling";
     $id = 1;
     $test_author = new Author($name, $id);
     $test_author->save();
     //Act
     $test_author->addBook($test_book);
     $test_author->delete();
     //Assert
     $this->assertEquals([], $test_book->getAuthors());
 }
开发者ID:bborealis,项目名称:library,代码行数:17,代码来源:AuthorTest.php

示例11: Delete

 /**
  * method Delete()
  * Delete a record
  */
 function Delete($param)
 {
     try {
         // get the parameter $key
         $key = $param['key'];
         // open a transaction with database 'library'
         TTransaction::open('library');
         // instantiates object Author
         $object = new Author($key);
         // deletes the object from the database
         $object->delete();
         // close the transaction
         TTransaction::close();
         // reload the listing
         $this->onReload();
         // shows the success message
         new TMessage('info', TAdiantiCoreTranslator::translate('Record deleted'));
     } catch (Exception $e) {
         // shows the exception error message
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // undo all pending operations
         TTransaction::rollback();
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:28,代码来源:AuthorList.class.php

示例12: array

if (!is_writable($Campsite['IMAGE_DIRECTORY'])) {
    camp_html_add_msg($translator->trans('Unable to add new image, target directory is not writable.', array(), 'users'));
    camp_html_add_msg(camp_get_error_message(CAMP_ERROR_WRITE_DIR, $Campsite['IMAGE_DIRECTORY']));
    camp_html_goto_page("/{$ADMIN}/");
    exit;
}
if (!$g_user->hasPermission('EditAuthors')) {
    camp_html_display_error($translator->trans('You do not have the permission to change authors.', array(), 'users'));
    exit;
}
$id = Input::Get('id', 'int', -1);
// Delete author
$del_id = Input::Get('del_id', 'int', -1);
if ($del_id > -1) {
    $author = new Author($del_id);
    if ($author->delete()) {
        camp_html_add_msg($translator->trans('Author deleted.', array(), 'users'), 'ok');
    }
}
// Add new author type
$add_author_type = Input::Get('add_author', 'string', null);
if ($add_author_type !== null) {
    $authorTypeObj = new AuthorType();
    if ($authorTypeObj->create($add_author_type) === true) {
        camp_html_add_msg($translator->trans('Author type added.', array(), 'users'), 'ok');
    } else {
        camp_html_add_msg($translator->trans('Cannot add author type, this type already exists.', array(), 'users'));
    }
}
// Delete author type
$del_id_type = Input::Get('del_id_type', 'int', -1);
开发者ID:kartoffelkage,项目名称:Newscoop,代码行数:31,代码来源:authors.php

示例13: configure

class DefaultValuesForm extends AuthorForm
{
    public function configure()
    {
        $this->setDefault('name', 'John Doe');
    }
}
$author = new Author();
$form = new DefaultValuesForm($author);
$t->is($form->getDefault('name'), 'John Doe', '->__construct() uses form defaults for new objects');
$author = new Author();
$author->name = 'Jacques Doe';
$author->save();
$form = new DefaultValuesForm($author);
$t->is($form->getDefault('name'), 'Jacques Doe', '->__construct() uses object value as a default for existing objects');
$author->delete();
// ->embedRelation()
$t->diag('->embedRelation()');
class myArticleForm extends ArticleForm
{
}
$table = Doctrine::getTable('Author');
$form = new AuthorForm($table->create(array('Articles' => array(array('title' => 'Article 1'), array('title' => 'Article 2'), array('title' => 'Article 3')))));
$form->embedRelation('Articles');
$embeddedForms = $form->getEmbeddedForms();
$t->ok(isset($form['Articles']), '->embedRelation() embeds forms');
$t->is(count($embeddedForms['Articles']), 3, '->embedRelation() embeds one form for each related object');
$form->embedRelation('Articles', 'myArticleForm', array(array('test' => true)));
$embeddedForms = $form->getEmbeddedForms();
$moreEmbeddedForms = $embeddedForms['Articles']->getEmbeddedForms();
$t->isa_ok($moreEmbeddedForms[0], 'myArticleForm', '->embedRelation() accepts a form class argument');
开发者ID:jaspertomas,项目名称:tmcprogram_tacloban,代码行数:31,代码来源:sfFormDoctrineTest.php

示例14: testDelete

 function testDelete()
 {
     //Arrange
     $name = "Paul Jones";
     $id = 1;
     $test_author = new Author($name, $id);
     $test_author->save();
     $title = "Little Cat";
     $id = 1;
     $test_book = new Book($title, $id);
     $test_book->save();
     //Act
     $test_author->addBook($test_book);
     $test_author->delete();
     //Assert
     $this->assertEquals([], $test_book->getAuthors());
 }
开发者ID:bborealis,项目名称:library-1,代码行数:17,代码来源:AuthorTest.php


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