Created
November 21, 2013 15:53
-
-
Save gpfiel/7584160 to your computer and use it in GitHub Desktop.
Create photo to album
This file contains hidden or 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
<?php | |
$album = new Album; | |
$photo = new Photo; | |
if(isset($_POST['id'])) | |
$album = $this->getEntityManager()->getRepository('Admin\Entity\Album')->find($this -> params() -> fromPost('id')); | |
$photo -> setDate(date_create($_POST['date_photo'])); | |
$photo -> setDescription($_POST['description_photo']); | |
$photo -> setMainPhoto($novo_nome); | |
$album -> assignedToPhoto($photo); | |
if(!isset($_POST['id'])) | |
{ | |
$album -> setTitle("Album incompleto."); | |
$album -> setStatus(2); | |
} | |
$em = $this->getEntityManager(); | |
$em -> persist($album); | |
$em -> persist($photo); | |
$em -> flush(); | |
$id_album = (isset($_POST['id']) ? $_POST['id'] : $album -> getId()); | |
$id_photo = $photo -> getId(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment