Symfony Study Guide – Small Project Implementation

Download Symfony Sandbox 1.4

Source : www.symfony-project.org/installation
Requirement : Xampp or Wamp Package
PHP: 5.2 Above

Download Symfony and put this into your website root

Rename sf_sandbox to your project name. Here it is CRM

open config/properties.yml file and put below details

[symfony]
name=CRM
author=Arun Raj R
orm=Doctrine

Next thing we have to configure our database

open command promt-> goto project folder crm>

type – >

php symfony configure:database “mysql:host=localhost;dbname=crmdb” root

if u want to give password then use following line instead of above

php symfony configure:database “mysql:host=localhost;dbname=crmdb” root password

Here our databse name is “crmdb”

Next thing we have to write down schema.yml file located in config/doctrine directory

I have created a sample schema.

# config/doctrine/schema.yml
State:
actAs: { Timestampable: ~ }
columns:
name: { type: string(255), notnull: true, unique: true }
Status:
actAs: { Timestampable: ~ }
columns:
name: { type: string(255), notnull: true, unique: true }
Project:
actAs: { Timestampable: ~ }
columns:
name: { type: string(255), notnull: true, unique: true }
Users:
actAs: { Timestampable: ~ }
columns:
state_id: { type: integer, notnull: true }
username: { type: string(255), notnull: true, unique: true }
password: { type: string(255), notnull: false, unique: true }
token: { type: string(255), notnull: true }
is_active: { type: boolean, notnull: true, default: 0 }
role: { type: integer, default: 0 }
relations:
State: { onDelete: CASCADE, local: state_id, foreign: id, foreignAlias: State }
Customer:
actAs: { Timestampable: ~ }
columns:
state_id: { type: integer, notnull: true }
mobile: { type: string(11), notnull: true, unique: true }
email: { type: string(255), notnull: false, unique: true }
name: { type: string(255), notnull: false }
address: { type: string(255)}
relations:
State: { onDelete: CASCADE, local: state_id, foreign: id, foreignAlias: State }
CallLog:
actAs: { Timestampable: ~ }
columns:
customer_id: { type: integer, notnull: true }
status_id: { type: integer, notnull: true }
project_id: { type: integer, notnull: true }
users_id: { type: integer, notnull: true }
response: { type: string(255) }
relations:
Project: { onDelete: CASCADE, local: project_id, foreign: id, foreignAlias: Project }
Customer: { onDelete: CASCADE, local: customer_id, foreign: id, foreignAlias: Customer }
Status: { onDelete: CASCADE, local: status_id, foreign: id, foreignAlias: Status }
Users: { onDelete: CASCADE, local: users_id, foreign: id, foreignAlias: Users }

Next thing is to create initial data dumb

Create this file in data/fixtures/fixtures.yml file

# # Populate this file with data to be loaded by your ORM’s *:data-load task.
# # You can create multiple files in this directory (i.e. 010_users.yml,
# # 020_articles.yml, etc) which will be loaded in alphabetical order.
# #
# # See documentation for your ORM’s *:data-load task for more information.
Status:
open:
name: Open
closed:
name: Closed
pending:
name: Pending
Project:
plotconsultant:
name: Plotconsutlant
State:
Andhra Pradesh:
name: Andhra Pradesh
Arunachal Pradesh:
name: Arunachal Pradesh
Assam:
name: Assam
Bihar:
name: Bihar
Chhattisgarh:
name: Chhattisgarh
Goa:
name: Goa
Gujarat:
name: Gujarat
Haryana:
name: Haryana
Himachal Pradesh:
name: Himachal Pradesh
Jammu and Kashmir:
name: Jammu and Kashmir
Jharkhand:
name: Jharkhand
Karnataka:
name: Karnataka
Kerala:
name: Kerala
Madhya Pradesh:
name: Madhya Pradesh
Maharashtra:
name: Maharashtra
Manipur:
name: Manipur
Meghalaya:
name: Meghalaya
Mizoram:
name: Mizoram
Nagaland:
name: Nagaland
Orissa:
name: Orissa
Punjab:
name: Punjab
Rajasthan:
name: Rajasthan
Sikkim:
name: Sikkim
Tamil Nadu:
name: Tamil Nadu
Tripura:
name: Tripura
Uttar Pradesh:
name: Uttar Pradesh
Uttarakhand:
name: Uttarakhand
West Bengal:
name: West Bengal

Open Command Prompt :
run this command
crm->

php symfony doctrine:build –all –and-load

$ php symfony doctrine:generate-module –with-show –non-verbose-templates frontend customer Customer
$ php symfony doctrine:generate-module –with-show –non-verbose-templates frontend log CallLog

then browse

http://localhost/crm/web/frontend_dev.php/customer
http://localhost/crm/web/frontend_dev.php/log

Then you can see add remove edit list option for customer table and CallLog Table

About

me : yeay its me arun

Tagged with: , , , , , , ,
One comment on “Symfony Study Guide – Small Project Implementation
  1. Dude, I think there exists a mistake in the first paragraph, but I need to say fascinating article. Thanks, ree Slappey

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.