PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, March 2, 2022

[FIXED] Update Propel Generated classes after modifying database

 March 02, 2022     composer-php, propel     No comments   

Issue

I wanted to update propel generated classes that are present in the model folder as I have modified my database schema (i.e., I have added one column in a table). What are the steps to update the model classes?


Solution

Please follow below steps to update propel model classes:

  1. Remove all the files inside the /vendor folder of your application

  2. execute the below command from the folder where composer.json exists

    $ composer update
    
  3. set the path variable to /path/to/vendor/bin folder

  4. Run the propel reverse task to generate schema.xml specifying your database credentials

     $ propel reverse "mysql:host=localhost;dbname=db;user=root;password=pwd"
    

    Output of above command will be schema.xml file

  5. Replace your schema.xml file in the project with this new one

  6. From the command prompt go to the folder where you copied schema.xml file and execute below commands.

    $ propel sql:build
    $ propel model:build
    

Thats it. Propel model classes should get updated.



Answered By - Raghavendra
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing