Advertisement
Guest User

cidoctrinrprob-2

a guest
Oct 30th, 2010
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 12.34 KB | None | 0 0
  1. Pls guide me with this error .... follwing are the error details.
  2.  
  3. When run this url "http://localhost/ci_doctrine/doctrine_tools/create_tables"
  4.  
  5. The errors i am getting is
  6.  
  7. "( ! ) Fatal error: Uncaught exception 'Doctrine_Export_Exception' with message 'SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'ph_user' doesn't exist in table. Failing Query: CREATE TABLE phone (id INT UNSIGNED NOT NULL AUTO_INCREMENT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX ph_user_idx (ph_user), INDEX ph_type_idx (ph_type), PRIMARY KEY(id)) ENGINE = INNODB' in C:\xampp\htdocs\ci_doctrine\application\plugins\doctrine\lib\Doctrine\Export.php on line 1210"
  8.  
  9. ( ! ) Doctrine_Export_Exception: SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'ph_user' doesn't exist in table. Failing Query: CREATE TABLE phone (id INT UNSIGNED NOT NULL AUTO_INCREMENT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX ph_user_idx (ph_user), INDEX ph_type_idx (ph_type), PRIMARY KEY(id)) ENGINE = INNODB in C:\xampp\htdocs\ci_doctrine\application\plugins\doctrine\lib\Doctrine\Export.php on line 1210
  10.  
  11. Follwing are the files
  12.  
  13. country.php
  14.  
  15. <?php
  16. class Country extends Doctrine_Record
  17. {
  18.     public function setTableDefinition()
  19.     {
  20.         $this->hasColumn('c_name', 'string', 100);
  21.         $this->hasColumn('c_idd','integer');
  22.         $this->hasColumn('c_cc','integer');
  23.         $this->hasColumn('c_details', 'string', 5000);
  24.     }
  25.  
  26.     public function setUp()
  27.     {
  28.         $this->setTableName('country');
  29.     $this->actAs('Timestampable');
  30.         $this->hasMany('State as State', array(
  31.                 'local' => 'id',
  32.                 'foreign' => 'c_id'
  33.             )
  34.         );
  35.     }
  36. }
  37. ?>
  38.  
  39. state.php
  40.  
  41. <?php
  42. class State extends Doctrine_Record
  43. {
  44.     public function setTableDefinition()
  45.     {
  46.         $this->hasColumn('c_id', 'integer',4);
  47.         $this->hasColumn('s_name', 'string', 100);
  48.         $this->hasColumn('s_details', 'string', 5000);
  49.     }
  50.  
  51.     public function setUp()
  52.     {
  53.         $this->setTableName('state');
  54.     $this->actAs('Timestampable');
  55.         $this->hasOne('Country as Country', array(
  56.                 'local' => 'c_id',
  57.                 'foreign' => 'id'
  58.             )
  59.         );
  60.         $this->hasMany('Destination as Destination', array(
  61.                 'local' => 'id',
  62.                 'foreign' => 's_id'
  63.             )
  64.         );
  65.     }
  66. }
  67. ?>
  68.  
  69. destination.php
  70.  
  71. <?php
  72. class Destination extends Doctrine_Record
  73. {
  74.     public function setTableDefinition()
  75.     {
  76.         $this->hasColumn('s_id', 'integer',4);
  77.         $this->hasColumn('d_name', 'string', 100);
  78.         $this->hasColumn('d_std','integer');
  79.         $this->hasColumn('d_details', 'string', 5000);
  80.     }
  81.  
  82.     public function setUp()
  83.     {
  84.         $this->setTableName('destination');
  85.     $this->actAs('Timestampable');
  86.        
  87.         $this->hasOne('State as State', array(
  88.                 'local' => 's_id',
  89.                 'foreign' => 'id'
  90.             )
  91.         );
  92.         $this->hasMany('Area as Area',array(
  93.             'local' => 'id',
  94.             'foreign' => 'd_id',
  95.         )
  96.                 );
  97.         $this->hasMany('Pic as Pic',array(
  98.             'local' => 'id',
  99.             'foreign' => 'd_id',
  100.         )
  101.                 );
  102.         $this->hasMany('Tourpackage as Tourpackage',array(
  103.             'local' => 'id',
  104.             'foreign' => 'tp_startplace',
  105.         )
  106.                 );
  107.         $this->hasMany('Tourpackage as Tourpackage',array(
  108.             'local' => 'id',
  109.             'foreign' => 'tp_endplace',
  110.         )
  111.                 );
  112.     }
  113. }
  114. ?>
  115.  
  116. area.php
  117.  
  118. <?php
  119. class Area extends Doctrine_Record
  120. {
  121.     public function setTableDefinition()
  122.     {
  123.         $this->hasColumn('d_id', 'integer',4);
  124.         $this->hasColumn('a_name', 'string', 100);
  125.         $this->hasColumn('a_pin','integer');
  126.         $this->hasColumn('a_details', 'string', 5000);
  127.     }
  128.  
  129.     public function setUp()
  130.     {
  131.         $this->setTableName('area');
  132.     $this->actAs('Timestampable');
  133.  
  134.         $this->hasOne('Destination as Destination', array(
  135.                 'local' => 'd_id',
  136.                 'foreign' => 'id'
  137.             )
  138.         );
  139.        $this->hasmany('Address as Address',array(
  140.             'local' => 'id',
  141.         'foreign' => 'adr_area',
  142.     ));
  143.     }
  144. }
  145. ?>
  146.  
  147. address.php
  148.  
  149. <?php
  150. class Address extends Doctrine_record
  151. {
  152.     public function setTableDefinition()
  153.     {
  154.         $this->hasColumn('adr_user','integer',4);
  155.         $this->hasColumn('adr_firstline','string',1000);
  156.         $this->hasColumn('adr_secondline','string',1000);
  157.         $this->hasColumn('adr_area','integer',4);
  158.         }
  159.         public function setUp()
  160.         {
  161.             $this->setTableName('address');
  162.             $this->actAs('Timestampable');
  163.             $this->hasOne('Users as Users',array(
  164.                                 'local' => 'adr_user',
  165.                                 'foreign' => 'id',
  166.                         )
  167.                         );
  168.                         $this->hasOne('Area as Area',array(
  169.                             'local' => 'adr_area',
  170.                             'foreign' => 'id',
  171.                     ));
  172.         }
  173.  
  174. }
  175. ?>
  176.  
  177. users.php
  178.  
  179. <?php
  180. class Users extends Doctrine_Record
  181. {
  182.     public function setTableDefinition()
  183.     {
  184.         $this->hasColumn('u_username', 'string',100);
  185.         $this->hasColumn('u_pass','string',100);
  186.         $this->hasColumn('u_regtype','integer',4);
  187.         $this->hasColumn('u_access','integer',4);
  188.         $this->hasColumn('u_name','string',100);
  189.         $this->hasColumn('u_pic','string',1000);
  190.         $this->hasColumn('u_company','integer',4);
  191.         $this->hasColumn('u_details', 'string',5000);
  192.     }
  193.  
  194.     public function setUp()
  195.     {
  196.         $this->setTableName('users');
  197.     $this->actAs('Timestampable');
  198.         $this->hasOne('Regtype as Regtype',array(
  199.             'local' => 'u_regtype',
  200.             'foreign' => 'id',
  201.     ));
  202.     $this->hasOne('Useraccess as Useraccess',array(
  203.         'local' => 'u_access',
  204.         'foreign' => 'id',
  205.                 ));
  206.             $this->hasMany('Address as Address',array(
  207.                     'local' => 'id',
  208.                     'foreign' => 'adr_user',
  209.         ));
  210.     $this->hasMany('Phone as Phone',array(
  211.         'local' => 'id',
  212.         'foreign' => 'ph_user',
  213.     ));
  214.     /*$this->hasMany('Website as Website',array(
  215.         'local' => 'id',
  216.         'foreign' => 'webs_user',
  217.     ));
  218.     $this->hasMany('Skype as Skype',array(
  219.         'local' => 'id',
  220.         'foreign' => 'skype_user',
  221.     ));
  222.     $this->hasMany('Invoice as Invoice',array(
  223.         'local' => 'id',
  224.         'foreign' => 'inv_user',
  225.     ));
  226.     $this->hasMany('Enquiry as Enquiry',array(
  227.         'local' => 'id',
  228.         'foreign' => 'enquiry_user',
  229.     ));
  230.     $this->hasmany('Users as Users',array(
  231.         'local' => 'id',
  232.         'foreign' => 'u_company',
  233.     ));
  234.     $this->hasOne('Users as Users',array(
  235.         'local' => 'u_company',
  236.         'foreign' => 'id',
  237.     ));*/
  238.     }
  239. }
  240. ?>
  241.  
  242. useraccess.php
  243.  
  244. <?php
  245. class Useraccess extends Doctrine_Record
  246. {
  247.     public function setTableDefinition()
  248.     {
  249.         $this->hasColumn('ua_name', 'string',100);
  250.         $this->hasColumn('ua_details', 'string',5000);
  251.     }
  252.  
  253.     public function setUp()
  254.     {
  255.         $this->setTableName('useraccess');
  256.     $this->actAs('Timestampable');
  257.     $this->hasMany('Users as Users',array(
  258.         'local' => 'id',
  259.         'foreign' => 'u_access',
  260.     ));
  261.     }
  262. }
  263.  
  264. ?>
  265.  
  266. tourpackagecost.php
  267.  
  268. <?php
  269. class Tourpackagecost extends Doctrine_Record
  270. {
  271.     public function setTableDefinition()
  272.     {
  273.         $this->hasColumn('tp_id','integer',4);
  274.         $this->hasColumn('tpcost_perperson','float');
  275.         $this->hasColumn('tpcost_percouple','float');
  276.         $this->hasColumn('tpcost_extraadult','float' );
  277.         $this->hasColumn('tpcost_extrachild', 'float');
  278.         $this->hasColumn('tpcost_conditions', 'string',1000);
  279.     }
  280.  
  281.     public function setUp()
  282.     {
  283.         $this->setTableName('tourpackagecost');
  284.     $this->actAs('Timestampable');
  285.         $this->hasOne('Tourpackage as Tourpackage',array(
  286.             'local' => 'tp_id',
  287.             'foreign' => 'id',
  288.         )
  289.                 );
  290.        
  291.  
  292.     }
  293. }
  294. ?>
  295.  tourpackage.php
  296.  
  297. <?php
  298. class Tourpackage extends Doctrine_Record
  299. {
  300.     public function setTableDefinition()
  301.     {
  302.         $this->hasColumn('tp_name', 'string', 100);
  303.         $this->hasColumn('tp_startplace','integer',4);
  304.         $this->hasColumn('tp_endplace','integer',4);
  305.         $this->hasColumn('tp_enroute', 'string',1000);
  306.         $this->hasColumn('tp_days', 'integer');
  307.         $this->hasColumn('tp_nights', 'integer');
  308.         $this->hasColumn('tp_details', 'string',5000);
  309.     }
  310.  
  311.     public function setUp()
  312.     {
  313.         $this->setTableName('tourpackage');
  314.     $this->actAs('Timestampable');
  315.         $this->hasOne('Destination as Destination',array(
  316.             'local' => 'tp_startplace',
  317.             'foreign' => 'id',
  318.         )
  319.                 );
  320.         $this->hasOne('Destination as Destination',array(
  321.             'local' => 'tp_endplace',
  322.             'foreign' => 'id',
  323.         )
  324.                 );
  325.        $this->hasMany('Tourpackagecost as Tourpackagecost',array(
  326.             'local' => 'id',
  327.             'foreign' => 'tp_id'
  328.         )
  329.                 );
  330.         /*$this->hasMany('Packagetype as Packagetype',array(
  331.             'local' => 'id',
  332.             'foreign' => 'tp_id',
  333.         )
  334.                 );
  335.         $this->hasMany('Packagehighlight as Packagehighlight',array(
  336.             'local' => 'id',
  337.             'foreign' => 'tp_id',
  338.         )
  339.                 );*/
  340.        
  341.     }
  342. }
  343. ?>
  344.  
  345. touristspot.php
  346.  
  347. <?php
  348. class Touristspot extends Doctrine_Record
  349. {
  350.     public function setTableDefinition()
  351.     {
  352.         $this->hasColumn('a_id', 'integer',4);
  353.         $this->hasColumn('ts_name', 'string', 100);
  354.         $this->hasColumn('a_details', 'string', 5000);
  355.     }
  356.  
  357.     public function setUp()
  358.     {
  359.         $this->setTableName('touristspot');
  360.     $this->actAs('Timestampable');
  361.  
  362.         $this->hasOne('Area as Area', array(
  363.                 'local' => 'a_id',
  364.                 'foreign' => 'id'
  365.             )
  366.         );
  367.         $this->hasMany('Pic as Pic',array(
  368.             'local' => 'id',
  369.             'foreign' => 'ts_id',
  370.         )
  371.                 );
  372.     }
  373. }
  374. ?>
  375.  
  376. regtype.php
  377.  
  378. <?php
  379. class Regtype extends Doctrine_Record
  380. {
  381.     public function setTableDefinition()
  382.     {
  383.         $this->hasColumn('rgt_name', 'string',100);
  384.         $this->hasColumn('rgt_details','string',5000);
  385.     }
  386.  
  387.     public function setUp()
  388.     {
  389.         $this->setTableName('regtype');
  390.     $this->actAs('Timestampable');
  391.     $this->hasMany('Users as Users',array(
  392.         'local' => 'id',
  393.         'foreign' => 'u_regtype',
  394.     ));
  395.        
  396.     }
  397. }
  398.  
  399. ?>
  400.  
  401. pic.php
  402.  
  403. <?php
  404. class Pic extends Doctrine_Record
  405. {
  406.     public function setTableDefinition()
  407.     {
  408.         $this->hasColumn('d_id', 'integer',4);
  409.         $this->hasColumn('ts_id', 'integer',4);
  410.         $this->hasColumn('pic_name', 'string', 100);
  411.         $this->hasColumn('pic_path','string',100);
  412.         $this->hasColumn('pic_details', 'string', 5000);
  413.     }
  414.  
  415.     public function setUp()
  416.     {
  417.         $this->setTableName('pic');
  418.     $this->actAs('Timestampable');
  419.  
  420.         $this->hasOne('Destination as Destination', array(
  421.                 'local' => 'd_id',
  422.                 'foreign' => 'id'
  423.             )
  424.         );
  425.         $this->hasOne('Touristspot as Touristspot',array(
  426.             'local' => 'ts_id',
  427.             'foreign' => 'id'
  428.         )
  429.                 );
  430.     }
  431. }
  432. ?>
  433.  
  434. phonetype.php
  435.  
  436. <?php
  437. class Phonetype extends Doctrine_record
  438. {
  439.     public function setTableDefinition()
  440.     {
  441.         $this->hasColumn('pt_name','string',100);
  442.         $this->hasColumn('pt_details','string',5000);
  443.     }
  444.     public function setUp()
  445.     {
  446.         $this->setTableName('phonetype');
  447.         $this->actAs('Timestampable');
  448.         $this->hasMany('Phone as Phone',array(
  449.             'local' => 'id',
  450.             'foreign' => 'ph_type',
  451.         ));
  452.     }
  453. }
  454.  
  455. ?>
  456.  
  457. phone.php
  458.  
  459. <?php
  460. class Phone extends Doctrine_record
  461. {
  462.     public function setTableDefination()
  463.     {
  464.         $this->hasColumn('ph_user','integer',4);
  465.         $this->hasColumn('ph_type','integer',4);
  466.         $this->hasColumn('ph_num','integer');
  467.     }
  468.     public function setUp()
  469.     {
  470.         $this->setTableName('phone');
  471.         $this->actAs('Timestampable');
  472.         $this->hasOne('Users as Users',array(
  473.             'local' => 'ph_user',
  474.             'foreign' => 'id',
  475.         ));
  476.         $this->hasOne('Phonetype as Phonetype',array(
  477.             'local' => 'ph_type',
  478.             'foreign' => 'id',
  479.         ));
  480.  
  481.     }
  482. }
  483.  
  484. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement