SlideShare a Scribd company logo
symfony                                                                                                                              Open-Source PHP5 MVC Framework
                                                                                                                                                   Agile Development



MODEL                                                                  DATABASE SCHEMA
The database schema is a description of the relational model to do the ORM.
                                                                                                                                 connection attributes
You define the tables, their relations, and the characteristics of their columns.
Symfony's syntax for schemas uses the YAML format.                                                           noXsd - Set it to false if you want your schema to be
Symfony also understands the Propel native XML schema format                                                 validated before code generation takes place.
                                                                                                             defaultIdMethod - If none is provided, then the database's
schema.yml                                                                                                   native method of generating IDs will be used--for example,
located in myproject/config/                                                                                 autoincrement for MySQL, or sequences for PostgreSQL.
                                                                                                             The other possible value is none.
                                                                                                             package - is like a namespace; it determines the path where
                            the first key represents a connection name                                       the generated classes are stored. It defaults to lib/model/,
                                                                                                             but you can change it to organize your model in subpackages.

                  propel:
                    _attributes:    {noXsd: false, defaultIdMethod: none, package: lib.model}
                    blog_article:
                      _attributes: { phpName: Article }
                      id:       {required: true, primaryKey: true, autoIncrement: true}
                      title:     varchar(255)
 tables               content: longvarchar
                      created_at:
                      name:      {type: varchar(50), default: foobar, index: true}
                      group_id: {type: integer, foreignTable: db_group, foreignReference: id}
                    blog_comment:
                                                                               column attributes
                      _attributes: { phpName: Comment }
                                                               type - Column type. The choices are boolean, tinyint,
                      id:                                      smallint, integer, bigint, double, float, real, decimal,
                      article_id:                              char, varchar(size), longvarchar, date, time, timestamp,
                                                               bu_date, bu_timestamp, blob, and clob.
                      author:       varchar(255)               required - Boolean. Set it to true if you want the
                      content:      longvarchar                column to be required.

                      created_at:                              default - Default value.
                                            table attributes
                                                                                                                      primaryKey - Boolean. Set it to true for primary keys.
                                                               phpName - the name of the class
                                                               that will be generated. If you don't                   autoIncrement - Boolean. Set it to true for columns
              empty column type                                mention a phpName for a table, the                     of type integer that need to take an auto-incremented
  Empty columns named id are considered PKs                    name will be the camelCase version                     value.
  id: { type: integer, required: true,                         of the table name.
       primaryKey: true, autoIncrement: true}
                                                                                                                      sequence - Sequence name for databases using
                                                                isI18N - Boolean. Set it to true for                  sequences for autoIncrement columns (for example,
                                                                i18n                                                  PostgreSQL and Oracle).
  Empty columns named XXX_id are
  considered foreign keys                                       i18nTable - name of the i18n table.                   index - Boolean. Set it to true if you want a simple
  foobar_id: {type: integer, foreignTable:                                                                            index or to unique if you want a unique index to be
              db_foobar, foreignReference: id}                                                                        created on the column.
                                                                   Indexes and Unique Indexes
  Empty columns named created_at,                                       Alternative Syntax                            foreignTable - A table name, used to create a foreign
  updated at, created_on and updated_on are                      propel:                                              key to another table.
  considered dates and automatically take the                     blog_article:
                                                                   id:                                                foreignReference - The name of the related column
  timestamp type                                                                                                      if a foreign key is defined via foreignTable.
  created_at: { type: timestamp }                                  title:            varchar(50)
  updated_at: { type: timestamp }                                  created_at:                                        onDelete - Determines the action to trigger when a
                                                                   _indexes:                                          record in a related table is deleted. When set to set
                                                                     my_index:       [title, user_id]                 null, the foreign key column is set to null. When set
                                                                   _uniques:                                          to cascade, the record is deleted. If the database
                                                                     my_other_index: [created_at]                     engine doesn't support the set behavior, the ORM
                                                 i18n                                                                 emulates it. This is relevant only for columns bearing
                              Tables that contain localized content                                                   a foreignTable and a foreignReference.
       Implied i18n                                   Explicit i18n Mechanism                                         isCulture - Boolean. Set it to true for culture columns
        Mechanism             propel:                                                                                 in localized content tables.
  propel:                      db_group:
   db_group:                    _attributes: { isI18N: true, i18nTable: db_group_i18n }
                                                                                                                           Foreign Key Alternative Syntax Applied to
    id:                         id:
                                                                                                                                 Multiple Reference Foreign Key
    created_at:                 created_at:
                                                                                                                           _foreignKeys:
   db_group_i18n:              db_group_i18n:                                                                               my_foreign_key:
    name:     varchar(50)       id:    { type: integer, required: true, primaryKey: true,                                     foreignTable: db_user
                                        foreignTable: db_group, foreignReference: id, onDelete: cascade }                     onDelete:      cascade
                                culture: { isCulture: true, type: varchar(7), required: true,primaryKey: true }               references:
                                name: varchar(50)                                                                              - { local: user_id, foreign: id }
                                                                                                                               - { local: post_id, foreign: id }
 http://andreiabohner.wordpress.com                                                                               This cheat-sheet is not an official part of the symfony documentation

More Related Content

What's hot

Subroutines in perl
Subroutines in perlSubroutines in perl
Subroutines in perl
sana mateen
 
Active Support Core Extension (2)
Active Support Core Extension (2)Active Support Core Extension (2)
Active Support Core Extension (2)RORLAB
 
Scalar data types
Scalar data typesScalar data types
What's New In Python 2.5
What's New In Python 2.5What's New In Python 2.5
What's New In Python 2.5
Richard Jones
 
Subroutines
SubroutinesSubroutines
PHP Course (Basic to Advance)
PHP Course (Basic to Advance)PHP Course (Basic to Advance)
PHP Course (Basic to Advance)
Coder Tech
 
CGI With Object Oriented Perl
CGI With Object Oriented PerlCGI With Object Oriented Perl
CGI With Object Oriented Perl
Bunty Ray
 
Perl Introduction
Perl IntroductionPerl Introduction
Perl Introduction
Marcos Rebelo
 
STC 2016 Programming Language Storytime
STC 2016 Programming Language StorytimeSTC 2016 Programming Language Storytime
STC 2016 Programming Language StorytimeSarah Kiniry
 
P H P Part I, By Kian
P H P  Part  I,  By  KianP H P  Part  I,  By  Kian
P H P Part I, By Kianphelios
 
Perl tutorial
Perl tutorialPerl tutorial
Perl tutorial
Manav Prasad
 
Wayfinder Breadcrumbs 1 1
Wayfinder Breadcrumbs 1 1Wayfinder Breadcrumbs 1 1
Wayfinder Breadcrumbs 1 1
Oleh Burkhay
 
Playfulness at Work
Playfulness at WorkPlayfulness at Work
Playfulness at Work
Erin Dees
 
Intro to Perl and Bioperl
Intro to Perl and BioperlIntro to Perl and Bioperl
Strings,patterns and regular expressions in perl
Strings,patterns and regular expressions in perlStrings,patterns and regular expressions in perl
Strings,patterns and regular expressions in perl
sana mateen
 
Ruby -the wheel Technology
Ruby -the wheel TechnologyRuby -the wheel Technology
Ruby -the wheel Technologyppparthpatel123
 
perl usage at database applications
perl usage at database applicationsperl usage at database applications
perl usage at database applicationsJoe Jiang
 

What's hot (19)

Subroutines in perl
Subroutines in perlSubroutines in perl
Subroutines in perl
 
Phpquick
PhpquickPhpquick
Phpquick
 
Active Support Core Extension (2)
Active Support Core Extension (2)Active Support Core Extension (2)
Active Support Core Extension (2)
 
Scalar data types
Scalar data typesScalar data types
Scalar data types
 
What's New In Python 2.5
What's New In Python 2.5What's New In Python 2.5
What's New In Python 2.5
 
Subroutines
SubroutinesSubroutines
Subroutines
 
PHP Course (Basic to Advance)
PHP Course (Basic to Advance)PHP Course (Basic to Advance)
PHP Course (Basic to Advance)
 
Php Learning show
Php Learning showPhp Learning show
Php Learning show
 
CGI With Object Oriented Perl
CGI With Object Oriented PerlCGI With Object Oriented Perl
CGI With Object Oriented Perl
 
Perl Introduction
Perl IntroductionPerl Introduction
Perl Introduction
 
STC 2016 Programming Language Storytime
STC 2016 Programming Language StorytimeSTC 2016 Programming Language Storytime
STC 2016 Programming Language Storytime
 
P H P Part I, By Kian
P H P  Part  I,  By  KianP H P  Part  I,  By  Kian
P H P Part I, By Kian
 
Perl tutorial
Perl tutorialPerl tutorial
Perl tutorial
 
Wayfinder Breadcrumbs 1 1
Wayfinder Breadcrumbs 1 1Wayfinder Breadcrumbs 1 1
Wayfinder Breadcrumbs 1 1
 
Playfulness at Work
Playfulness at WorkPlayfulness at Work
Playfulness at Work
 
Intro to Perl and Bioperl
Intro to Perl and BioperlIntro to Perl and Bioperl
Intro to Perl and Bioperl
 
Strings,patterns and regular expressions in perl
Strings,patterns and regular expressions in perlStrings,patterns and regular expressions in perl
Strings,patterns and regular expressions in perl
 
Ruby -the wheel Technology
Ruby -the wheel TechnologyRuby -the wheel Technology
Ruby -the wheel Technology
 
perl usage at database applications
perl usage at database applicationsperl usage at database applications
perl usage at database applications
 

Similar to Sfmodelsecondpartrefcard

CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
C++ Homework Help
 
Net framework
Net frameworkNet framework
Net framework
Abhishek Mukherjee
 
What's New In Python 2.4
What's New In Python 2.4What's New In Python 2.4
What's New In Python 2.4
Richard Jones
 
Using SPMetal for faster SharePoint development
Using SPMetal for faster SharePoint developmentUsing SPMetal for faster SharePoint development
Using SPMetal for faster SharePoint development
Pranav Sharma
 
How to write Ruby extensions with Crystal
How to write Ruby extensions with CrystalHow to write Ruby extensions with Crystal
How to write Ruby extensions with Crystal
Anna (gaar4ica) Shcherbinina
 
Object-oriented programming
Object-oriented programmingObject-oriented programming
Object-oriented programming
Neelesh Shukla
 
Using SP Metal for faster share point development
Using SP Metal for faster share point developmentUsing SP Metal for faster share point development
Using SP Metal for faster share point developmentPranav Sharma
 
Online CPP Homework Help
Online CPP Homework HelpOnline CPP Homework Help
Online CPP Homework Help
C++ Homework Help
 
اسلاید جلسه ۹ کلاس پایتون برای هکر های قانونی
اسلاید جلسه ۹ کلاس پایتون برای هکر های قانونیاسلاید جلسه ۹ کلاس پایتون برای هکر های قانونی
اسلاید جلسه ۹ کلاس پایتون برای هکر های قانونی
Mohammad Reza Kamalifard
 
LISP: Object Sytstem Lisp
LISP: Object Sytstem LispLISP: Object Sytstem Lisp
LISP: Object Sytstem Lisp
LISP Content
 
LISP:Object System Lisp
LISP:Object System LispLISP:Object System Lisp
LISP:Object System Lisp
DataminingTools Inc
 
Advanced php
Advanced phpAdvanced php
Advanced phphamfu
 
Oops concepts in php
Oops concepts in phpOops concepts in php
Oops concepts in php
CPD INDIA
 
Java
JavaJava
CCF #1: Taking the reins of your data with Hiera 5
CCF #1: Taking the reins of your data with Hiera 5CCF #1: Taking the reins of your data with Hiera 5
CCF #1: Taking the reins of your data with Hiera 5
davidmogar
 
Learn c sharp at amc square learning
Learn c sharp at amc square learningLearn c sharp at amc square learning
Learn c sharp at amc square learning
ASIT Education
 
Drupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsDrupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First Steps
Luís Carneiro
 
The Style of C++ 11
The Style of C++ 11The Style of C++ 11
The Style of C++ 11
Sasha Goldshtein
 

Similar to Sfmodelsecondpartrefcard (20)

CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 
Net framework
Net frameworkNet framework
Net framework
 
JVM
JVMJVM
JVM
 
What's New In Python 2.4
What's New In Python 2.4What's New In Python 2.4
What's New In Python 2.4
 
Using SPMetal for faster SharePoint development
Using SPMetal for faster SharePoint developmentUsing SPMetal for faster SharePoint development
Using SPMetal for faster SharePoint development
 
How to write Ruby extensions with Crystal
How to write Ruby extensions with CrystalHow to write Ruby extensions with Crystal
How to write Ruby extensions with Crystal
 
Object-oriented programming
Object-oriented programmingObject-oriented programming
Object-oriented programming
 
Using SP Metal for faster share point development
Using SP Metal for faster share point developmentUsing SP Metal for faster share point development
Using SP Metal for faster share point development
 
Online CPP Homework Help
Online CPP Homework HelpOnline CPP Homework Help
Online CPP Homework Help
 
Symfony ORM
Symfony ORMSymfony ORM
Symfony ORM
 
اسلاید جلسه ۹ کلاس پایتون برای هکر های قانونی
اسلاید جلسه ۹ کلاس پایتون برای هکر های قانونیاسلاید جلسه ۹ کلاس پایتون برای هکر های قانونی
اسلاید جلسه ۹ کلاس پایتون برای هکر های قانونی
 
LISP: Object Sytstem Lisp
LISP: Object Sytstem LispLISP: Object Sytstem Lisp
LISP: Object Sytstem Lisp
 
LISP:Object System Lisp
LISP:Object System LispLISP:Object System Lisp
LISP:Object System Lisp
 
Advanced php
Advanced phpAdvanced php
Advanced php
 
Oops concepts in php
Oops concepts in phpOops concepts in php
Oops concepts in php
 
Java
JavaJava
Java
 
CCF #1: Taking the reins of your data with Hiera 5
CCF #1: Taking the reins of your data with Hiera 5CCF #1: Taking the reins of your data with Hiera 5
CCF #1: Taking the reins of your data with Hiera 5
 
Learn c sharp at amc square learning
Learn c sharp at amc square learningLearn c sharp at amc square learning
Learn c sharp at amc square learning
 
Drupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsDrupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First Steps
 
The Style of C++ 11
The Style of C++ 11The Style of C++ 11
The Style of C++ 11
 

Recently uploaded

Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 

Recently uploaded (20)

Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 

Sfmodelsecondpartrefcard

  • 1. symfony Open-Source PHP5 MVC Framework Agile Development MODEL DATABASE SCHEMA The database schema is a description of the relational model to do the ORM. connection attributes You define the tables, their relations, and the characteristics of their columns. Symfony's syntax for schemas uses the YAML format. noXsd - Set it to false if you want your schema to be Symfony also understands the Propel native XML schema format validated before code generation takes place. defaultIdMethod - If none is provided, then the database's schema.yml native method of generating IDs will be used--for example, located in myproject/config/ autoincrement for MySQL, or sequences for PostgreSQL. The other possible value is none. package - is like a namespace; it determines the path where the first key represents a connection name the generated classes are stored. It defaults to lib/model/, but you can change it to organize your model in subpackages. propel: _attributes: {noXsd: false, defaultIdMethod: none, package: lib.model} blog_article: _attributes: { phpName: Article } id: {required: true, primaryKey: true, autoIncrement: true} title: varchar(255) tables content: longvarchar created_at: name: {type: varchar(50), default: foobar, index: true} group_id: {type: integer, foreignTable: db_group, foreignReference: id} blog_comment: column attributes _attributes: { phpName: Comment } type - Column type. The choices are boolean, tinyint, id: smallint, integer, bigint, double, float, real, decimal, article_id: char, varchar(size), longvarchar, date, time, timestamp, bu_date, bu_timestamp, blob, and clob. author: varchar(255) required - Boolean. Set it to true if you want the content: longvarchar column to be required. created_at: default - Default value. table attributes primaryKey - Boolean. Set it to true for primary keys. phpName - the name of the class that will be generated. If you don't autoIncrement - Boolean. Set it to true for columns empty column type mention a phpName for a table, the of type integer that need to take an auto-incremented Empty columns named id are considered PKs name will be the camelCase version value. id: { type: integer, required: true, of the table name. primaryKey: true, autoIncrement: true} sequence - Sequence name for databases using isI18N - Boolean. Set it to true for sequences for autoIncrement columns (for example, i18n PostgreSQL and Oracle). Empty columns named XXX_id are considered foreign keys i18nTable - name of the i18n table. index - Boolean. Set it to true if you want a simple foobar_id: {type: integer, foreignTable: index or to unique if you want a unique index to be db_foobar, foreignReference: id} created on the column. Indexes and Unique Indexes Empty columns named created_at, Alternative Syntax foreignTable - A table name, used to create a foreign updated at, created_on and updated_on are propel: key to another table. considered dates and automatically take the blog_article: id: foreignReference - The name of the related column timestamp type if a foreign key is defined via foreignTable. created_at: { type: timestamp } title: varchar(50) updated_at: { type: timestamp } created_at: onDelete - Determines the action to trigger when a _indexes: record in a related table is deleted. When set to set my_index: [title, user_id] null, the foreign key column is set to null. When set _uniques: to cascade, the record is deleted. If the database my_other_index: [created_at] engine doesn't support the set behavior, the ORM i18n emulates it. This is relevant only for columns bearing Tables that contain localized content a foreignTable and a foreignReference. Implied i18n Explicit i18n Mechanism isCulture - Boolean. Set it to true for culture columns Mechanism propel: in localized content tables. propel: db_group: db_group: _attributes: { isI18N: true, i18nTable: db_group_i18n } Foreign Key Alternative Syntax Applied to id: id: Multiple Reference Foreign Key created_at: created_at: _foreignKeys: db_group_i18n: db_group_i18n: my_foreign_key: name: varchar(50) id: { type: integer, required: true, primaryKey: true, foreignTable: db_user foreignTable: db_group, foreignReference: id, onDelete: cascade } onDelete: cascade culture: { isCulture: true, type: varchar(7), required: true,primaryKey: true } references: name: varchar(50) - { local: user_id, foreign: id } - { local: post_id, foreign: id } http://andreiabohner.wordpress.com This cheat-sheet is not an official part of the symfony documentation