PHP code example of 2lenet / entity-file-bundle
1. Go to this page and download the library: Download 2lenet/entity-file-bundle library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
2lenet / entity-file-bundle example snippets
$manager = $entityFileLoader->get("seller_logos");
$manager = $entityFileLoader->get("seller_logos");
$entityFile = $manager->save($seller, $data, $path);
$this->em->persist($entityFile);
$this->em->flush();
$manager = $entityFileLoader->get("unicorn");
$entityFile = $manager->save($seller, $data, "unicorn.png");
$entityFile->setDescription("Picture of a very sexy unicorn");
$this->em->persist($entityFile);
$this->em->flush();
$manager = $entityFileLoader->get("seller_logos");
$manager->save($order, $data, "you/can/do/this");
// example:
$dir = $order->getDate()->format("Y-m");
$name = $order->getId() . ".xml";
$manager->save($order, $data, $dir . "/" . $name)
$manager = $entityFileLoader->get("seller_logos");
$manager->get($seller);
$manager->getOne($seller);
$manager = $entityFileLoader->get("seller_logos");
$manager->read($file);
$manager->readStream($file);
$manager = $entityFileLoader->get("seller_logos");
// deletes the entity and the actual file
$manager->delete($file);
$manager = $entityFileLoader->get("seller_logos");
$manager->move($file, "actually_not_an_unicorn.png");
$this->em->flush();
public function getTabs(): array
{
return [
"tab.files" => EntityFileBrickConfig::new("seller_logos"),
];
}