Doctrine Insert,Edit,Del

$entityManager = $this->getServiceLocator()->get(‘Doctrine\ORM\EntityManager’);

$post = $entityManager->getRepository(‘Saletarget\Entity\StAlloc2Sup’);

Insert :

$post = new StAlloc2Sup();
$entityManager->persist($post);

$post->setAreaId($postAllocTemp->getAreaId());
$post->setSupId($postAllocTemp->getSupId());
$post->setProductNodeId($postAllocTemp->getProductNodeId());
$post->setCycleNumber(1);
$post->setAllocYear($cur_date);

$entityManager->flush();

Edit :

$post = $entityManager->getRepository(‘Saletarget\Entity\StTempAlloc2Sup’)->find($postAllocTemp->getAllocIdTemp());

$post->setStatusName(‘approve’)

$entityManager->flush();

Del :

$post = $entityManager->getRepository(‘Saletarget\Entity\Comment’)->find($num);

$entityManager->remove($post);

$entityManager->flush();

Credit by : www.iDevelopper.net

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s