src/App/Entity/Filesystem/LooseFolder.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Filesystem;
  3. use App\Entity\Shared\UlidIdentifiableInterface;
  4. use App\Entity\Shared\UlidIdentifiableTrait;
  5. use Cms\CoreBundle\Model\Interfaces\Blameable\BlameableInterface;
  6. use Cms\CoreBundle\Model\Interfaces\Blameable\BlameableTrait;
  7. use Cms\CoreBundle\Model\Interfaces\Timestampable\TimestampableInterface;
  8. use Cms\CoreBundle\Model\Interfaces\Timestampable\TimestampableTrait;
  9. use Cms\TenantBundle\Model\TenantableInterface;
  10. use Cms\TenantBundle\Model\TenantableTrait;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection;
  13. use Doctrine\Common\Collections\Criteria;
  14. use Doctrine\ORM\Mapping as ORM;
  15. /**
  16.  * @ORM\Entity(
  17.  *     repositoryClass = "App\Doctrine\Repository\Filesystem\LooseFolderRepository",
  18.  * )
  19.  * @ORM\Table(
  20.  *     name = "sys__filesystem__temp_folder",
  21.  * )
  22.  */
  23. class LooseFolder
  24.     implements
  25.         UlidIdentifiableInterface,
  26.         TenantableInterface,
  27.         TimestampableInterface,
  28.         BlameableInterface
  29. {
  30.     use UlidIdentifiableTrait;
  31.     use TenantableTrait;
  32.     use TimestampableTrait;
  33.     use BlameableTrait;
  34.     /**
  35.      * @var ArrayCollection|LooseFile[]
  36.      *
  37.      * @ORM\OneToMany(
  38.      *     targetEntity = "App\Entity\Filesystem\LooseFile",
  39.      *     mappedBy = "folder",
  40.      * )
  41.      * @ORM\OrderBy({
  42.      *     "name" = "ASC",
  43.      * })
  44.      */
  45.     protected $files;
  46.     /**
  47.      *
  48.      */
  49.     public function __construct()
  50.     {
  51.         $this->files = new ArrayCollection();
  52.     }
  53.     /**
  54.      * @param Criteria|null $criteria
  55.      * @return iterable|Collection|ArrayCollection
  56.      */
  57.     public function getFiles(?Criteria $criteria null): iterable
  58.     {
  59.         if ( ! $this->files instanceof Collection) {
  60.             $this->files = new ArrayCollection();
  61.         }
  62.         if ( ! empty($criteria)) {
  63.             return $this->files->matching($criteria);
  64.         }
  65.         return $this->files;
  66.     }
  67. }