Created
April 22, 2016 08:38
-
-
Save a-ast/cbca016aef50829e62a335f1e1cc97d2 to your computer and use it in GitHub Desktop.
Doctrine merge examples
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
public function test_merge_listing() | |
{ | |
$listingContact = new ListingContact(); | |
$listingContact | |
->setId(3) | |
->setEmail('[email protected]') | |
->setMobilePhonePrefix('01578'); | |
$listing = new Listing(); | |
$listing | |
->setId(8) | |
->setSku('new sku') | |
->setDescription('Description of listing') | |
->setListingStart(new \DateTime()) | |
->setListingEnd(new \DateTime("+120 days")) | |
->setOwnerId(1) | |
->setStatus('active') | |
->setStatusOwner('active') | |
->setPrice(1000) | |
->setShowListingAddress(false) | |
->setPriceNotAvailable(false) | |
->setTopPosition(1) | |
->setAddress('Listing address') | |
->setPetApproved(true) | |
->setPin(new Point([0, 0])) | |
->setCategory(null) | |
->setContact($listingContact); | |
$this->em->merge($listing); | |
$this->em->flush(); | |
} | |
public function test_merge_listing_contact() | |
{ | |
$listingContact = new ListingContact(); | |
$listingContact | |
->setId(2) | |
->setEmail('[email protected]') | |
->setMobilePhonePrefix('01573'); | |
$this->em->merge($listingContact); | |
$this->em->flush(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment