本文整理汇总了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);
}
示例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());
}
示例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);
}
示例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);
}
示例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());
}
示例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());
}
示例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);
}
示例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]);
}
示例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());
}
示例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());
}
示例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();
}
}
示例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);
示例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');
示例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());
}