Skip to content

Zend Framework 1.8 Models and Mappers auto generate

Notifications You must be signed in to change notification settings

chilladx/CommandLine

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CommandLine

Zend Framework 1.8 Models and Mappers auto generate

Why using CommandLine ?

Every time that u will make a change inside the DB u don't need to change manually your model or your mapper just run the model generator. Right now just run this script after you create your database or after any DB shema modification

What Files U can use or edit ?

If u need a model, buisnessObjet or an Entity just call it from models/Entity folder for example

new Application_Model_Entity_User();

and put your custom code inside it. Same thing for the mapper :

new Application_Model_Mapper_User();

DO NEVER CHANGE CODE ONLY INSIDE ENTITY OR MAPPER FOLDER!

Default methods:

By default U can call all your model getters and setters alreday auto generated. Like:

 $user = new Application_Model_Entity_User();
 $user->setId(1)
  ->setName('Amine')
  ->setLastName('Cherif')
  ->setEnglishLanguageLevel(0)
  ->setPoor(TRUE);

And the default Mapper like

$userMapper = new Application_Model_Mapper_User();
$userMapper->save($user);

Your mapper have by default those methods:

fetchAll() // Get an array of all buisness objects stored on the current table
populateForm($id) // Get the appropriated array to be populated by Zend_Form
find($id) // Similar to getElementById
delete($id) // If u guess what that method do u are the next Steve Jobs ;)
save($buisnessObject) // so hard to explain :P

Installation

Put the CommandLine into Zend library Folder Copy and paste bin folder on your project folder

Use

  • Open your console and go inside the bin folder

  • and run: sudo php modelgenerator.php

==> don't forget to change the Model folder permissions

TO DO IN NEXT VERSION:

Adding many to many and one to many relations

License :

I don't know but u can do allllllllllll u want with this script :D About the author :

Case u don't understand this script:

It's not a secret be smart and do like that u understand it's all what we do all the time else forget about your promotion !

Regards

  • Thank u for all your feed back and feel free to commit new crazy things .
  • Sorry about my poor English (I need a cute English Teacher Girl Friend ;) )
  • Good Luck!

About

Zend Framework 1.8 Models and Mappers auto generate

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%