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