-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Romain Monteil
committed
Dec 17, 2018
1 parent
cc35898
commit f821357
Showing
28 changed files
with
623 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
public/build/css/app.4aa95248.css → public/build/css/app.38ae95b3.css
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace App\Annotation; | ||
|
||
use Doctrine\Common\Annotations\Annotation; | ||
|
||
/** | ||
* This file defined an annotation to target a class. | ||
* | ||
* @Annotation | ||
* @Target("CLASS") | ||
* | ||
* @author Romain Monteil <monteil.romain@gmail.com> | ||
*/ | ||
class Uploadable | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace App\Annotation; | ||
|
||
use Doctrine\Common\Annotations\Annotation\Target; | ||
use Doctrine\Common\Annotations\AnnotationException; | ||
|
||
/** | ||
* This file defined an annotation to target a property on a class. | ||
* | ||
* @Annotation | ||
* @Target("PROPERTY") | ||
* | ||
* @author Romain Monteil <monteil.romain@gmail.com> | ||
*/ | ||
class UploadableField | ||
{ | ||
private $filename; | ||
|
||
private $path; | ||
|
||
public function __construct(array $options) | ||
{ | ||
if (!isset($options['filename'])) { | ||
throw new AnnotationException('Attribute "filename" is required for UploadableField annotation.'); | ||
} | ||
|
||
if (!isset($options['path'])) { | ||
throw new AnnotationException('Attribute "path" is required for UploadableField annotation.'); | ||
} | ||
|
||
$this->filename = $options['filename']; | ||
$this->path = $options['path']; | ||
} | ||
|
||
public function getFilename(): string | ||
{ | ||
return $this->filename; | ||
} | ||
|
||
public function getPath(): string | ||
{ | ||
return $this->path; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace App\Annotation; | ||
|
||
use Doctrine\Common\Annotations\Reader; | ||
|
||
/** | ||
* @author Romain Monteil <monteil.romain@gmail.com> | ||
*/ | ||
class UploadableReader | ||
{ | ||
private $reader; | ||
|
||
public function __construct(Reader $reader) | ||
{ | ||
$this->reader = $reader; | ||
} | ||
|
||
public function isUploadable($entity): bool | ||
{ | ||
$reflection = new \ReflectionClass(\get_class($entity)); | ||
|
||
return null !== $this->reader->getClassAnnotation($reflection, Uploadable::class); | ||
} | ||
|
||
public function getUploadableFields($entity): array | ||
{ | ||
$reflection = new \ReflectionClass(\get_class($entity)); | ||
|
||
$properties = []; | ||
if ($this->isUploadable($entity)) { | ||
foreach ($reflection->getProperties() as $property) { | ||
$propertyAnnotation = $this->reader->getPropertyAnnotation($property, UploadableField::class); | ||
if (null !== $propertyAnnotation) { | ||
$properties[$property->getName()] = $propertyAnnotation; | ||
} | ||
} | ||
} | ||
|
||
return $properties; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace App\Entity\Interfaces; | ||
|
||
/** | ||
* This interface allow us to mark an Entity as Timestampable. | ||
* | ||
* @author Romain Monteil <monteil.romain@gmail.com> | ||
*/ | ||
interface TimestampableEntityInterface | ||
{ | ||
public function getCreatedAt(): ?\DateTimeInterface; | ||
|
||
public function setCreatedAt(); | ||
|
||
public function getUpdatedAt(): ?\DateTimeInterface; | ||
|
||
public function setUpdatedAt(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.