Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1.  
  2.  
  3. public function isExistClientProductCode($clientProductCod)
  4. {
  5. $table = TableRegistry(..);
  6. $entity = $table->find()
  7. ->where(['client_product_code' => $clientProductCod])
  8. ->first();
  9. $return $entity();
  10. }
  11.  
  12. public function create($entityProduct)
  13. {
  14. $table = TableRegistry();
  15. $entity = new Entity();
  16. $entity = $entityProduct->product_uuid;
  17. $entity = $entityProduct->clientProductCode;
  18. $table->save($entity);
  19. }
  20.  
  21. public function update($clientProductCode)
  22. {
  23. $table = TableRegistry();
  24. $entity = $table->find()
  25. ->where(['client_product_code' => $clientProductCod]);
  26. $entity->modified = null;
  27. $table->save();
  28. }
  29.  
  30. $product = $product->findProductByClientCode();
  31.  
  32. if($product)
  33. {
  34. if(isExistClientProductCode($clientProductCode)){
  35. domain->update($clientProductCode);
  36. }else{
  37. domain->create($product);
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement