I need to use a property in one of my entities to set the value of another property in that same entity.
Let me explain myself, i have two properties, one of them is the image name, and the other one is a download link, in order to get a download link i need to take the image name and pass it to a function that would get my download link from the web
I have been looking at the life cycle methods on doctrine, but i cant get it to work, at the moment i only want to dislay that image name into the download link property.
So, the user uploads a file, i get the name of the file back, i take that name and use it to fetch a download link within my download link property.
Im using the "PostPersist" method and again, its just returning a null value when i take a look at my DB
Entity:
/**
* @ORM\Column(type="text", nullable=true)
*/
private $downloadImage;
//I commented out the setters and getters, cause i dont think i
//need them since i will be setting the value by default in the
//"PostPersist" method
PostPersist Method:
/**
* @ORM\PostPersist
*/
public function setDownloadLinkValue ()
{
$this->downloadImage = $this->getImageName(); //Yes yes, i have tried both, with "getImageName()" and "imageName"
}
I think its a very silly error, but im not 100% sure, if you need something else to see in my code please let me know so i can update this post