Neos\Media\Domain\Model\Asset::setTitle PHP Метод

setTitle() публичный Метод

Sets the title of this image (optional)
public setTitle ( string $title ) : void
$title string
Результат void
    public function setTitle($title)
    {
        $this->lastModified = new \DateTime();
        $this->title = $title;
    }

Usage Example

 /**
  * @test
  */
 public function findBySearchTermAndTagsReturnsFilteredResult()
 {
     $tag = new Tag('home');
     $this->tagRepository->add($tag);
     $resource1 = $this->resourceManager->importResource(__DIR__ . '/../../Fixtures/Resources/license.txt');
     $resource2 = $this->resourceManager->importResource(__DIR__ . '/../../Fixtures/Resources/417px-Mihaly_Csikszentmihalyi.jpg');
     $asset1 = new Asset($resource1);
     $asset1->setTitle('asset for homepage');
     $asset2 = new Asset($resource2);
     $asset2->setTitle('just another asset');
     $asset2->addTag($tag);
     $this->assetRepository->add($asset1);
     $this->assetRepository->add($asset2);
     $this->persistenceManager->persistAll();
     $this->persistenceManager->clearState();
     $this->assertCount(2, $this->assetRepository->findBySearchTermOrTags('home', array($tag)));
     $this->assertCount(2, $this->assetRepository->findBySearchTermOrTags('homepage', array($tag)));
     $this->assertCount(1, $this->assetRepository->findBySearchTermOrTags('baz', array($tag)));
     // This is necessary to initialize all resource instances before the tables are deleted
     foreach ($this->assetRepository->findAll() as $asset) {
         $asset->getResource()->getSha1();
     }
 }