本文整理匯總了PHP中FileModel::forgetAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileModel::forgetAll方法的具體用法?PHP FileModel::forgetAll怎麽用?PHP FileModel::forgetAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FileModel
的用法示例。
在下文中一共展示了FileModel::forgetAll方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testMakeByExistingFileModelId
public function testMakeByExistingFileModelId()
{
$oldFileContentsCount = FileContent::getCount();
$file1 = ZurmoTestHelper::createFileModel('testNote.txt');
$file2 = FileModelUtil::makeByExistingFileModelId($file1->id, true);
$file1Content = $file1->fileContent;
$file2Id = $file2->id;
$this->assertTrue($file2 !== false);
$this->assertEquals($file1->name, $file2->name);
$this->assertEquals($file1->type, $file2->type);
$this->assertEquals($file1->size, $file2->size);
$this->assertEquals($file1Content->content, $file2->fileContent->content);
// because fileContent was not replicated but referenced in file2.
$this->assertEquals($file1Content->id, $file2->fileContent->id);
$this->assertEquals($oldFileContentsCount + 1, FileContent::getCount());
$file1->delete();
FileModel::forgetAll();
$file2 = FileModel::getById($file2Id);
$this->assertEquals($file1Content->content, $file2->fileContent->content);
// deleting file1 should still preserve its content as its being used by file2.
$this->assertEquals($oldFileContentsCount + 1, FileContent::getCount());
$file2->delete();
// deleting fil2 should get rid of the fileContent too.
$this->assertEquals($oldFileContentsCount, FileContent::getCount());
}