Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. var $belongsTo = array(
  2. 'Company' => array(
  3. 'className' => 'Company',
  4. 'foreignKey' => 'company_id',
  5. 'dependent' => false,
  6. ),
  7. );
  8.  
  9. var $hasMany = array(
  10. 'User' => array(
  11. 'className' => 'User',
  12. 'foreignKey' => 'company_id',
  13. 'dependent' => false
  14. ),
  15. 'Customer'=>array(
  16. 'className' => 'Customer',
  17. 'foreignKey' => 'company_id',
  18. 'dependent' => false
  19. )
  20. );
  21.  
  22. var $belongsTo = array(
  23. 'Company' => array(
  24. 'className' => 'Company',
  25. 'foreignKey' => 'company_id',
  26. 'dependent' => false,
  27. ),
  28. );
  29.  
  30. echo $this->Form->input('Customer.customer_nr');
  31. echo $this->Form->input('Customer.name');
  32. echo $this->Form->input('Customer.phone');
  33. echo $this->Form->input('Customer.email');
  34. echo $this->Form->input('Customer.address');
  35. echo $this->Form->input('Customer.post_nr');
  36. echo $this->Form->input('Customer.city');
  37. echo $this->Form->input('Customer.company_id', array('value' => $current_user['company_id'], 'type'=>'hidden'));
  38.  
  39. Error: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'name' in where clause is ambiguous
  40.  
  41. function add() {
  42.  
  43.  
  44.  
  45. if (!empty($this->data) ) {
  46. $this->Customer->create();
  47. if ($this->Customer->save($this->data)) {
  48. $this->Session->setFlash(__('Customer was saved'), 'positive_notification');
  49. $this->redirect(array('controller'=>'events', 'action' => 'dashboard'));
  50. } else {
  51. $this->Session->setFlash(__('Customer has been saved. Please, try again'), 'negative_notification');
  52. }
  53. }
  54.  
  55. 'conditions' => array(
  56. 'name' => 'john'
  57. )
  58.  
  59. 'conditions' => array(
  60. 'User.name' => 'john'
  61. )
  62.  
  63. 'conditions' => array(
  64. 'name' => 'john'
  65. ),
  66. 'recursive' => -1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement