Author: COil Date: 2010-04-12 17:45:00 +0200 (Mon, 12 Apr 2010) New Revision: 29090
Added: plugins/sfDB4toPropelPlugin/branches/1.2/doc/ plugins/sfDB4toPropelPlugin/branches/1.2/doc/database/ plugins/sfDB4toPropelPlugin/branches/1.2/doc/database/db4.xml Modified: plugins/sfDB4toPropelPlugin/branches/1.2/LICENSE plugins/sfDB4toPropelPlugin/branches/1.2/README plugins/sfDB4toPropelPlugin/branches/1.2/lib/task/sfDB4toPropelTask.class.php plugins/sfDB4toPropelPlugin/branches/1.2/package.xml Log: [sfDB4toPropelPlugin] * Updates for sf 1.3 and 1.4 Modified: plugins/sfDB4toPropelPlugin/branches/1.2/LICENSE =================================================================== --- plugins/sfDB4toPropelPlugin/branches/1.2/LICENSE 2010-04-12 15:12:01 UTC (rev 29089) +++ plugins/sfDB4toPropelPlugin/branches/1.2/LICENSE 2010-04-12 15:45:00 UTC (rev 29090) @@ -1,4 +1,4 @@ -Plugin by COil. +Symfony plugin by Vernet Loïc aka COil. (qrf_coil[at]yahoo[dot]fr) The DBDesigner4 software is made by fabFORCE. (http://fabforce.net/dbdesigner4) Modified: plugins/sfDB4toPropelPlugin/branches/1.2/README =================================================================== --- plugins/sfDB4toPropelPlugin/branches/1.2/README 2010-04-12 15:12:01 UTC (rev 29089) +++ plugins/sfDB4toPropelPlugin/branches/1.2/README 2010-04-12 15:45:00 UTC (rev 29090) @@ -1,5 +1,5 @@ -sfDB4toPropelPlugin for symfony 1.2.x -===================================== +sfDB4toPropelPlugin for symfony 1.2.x, 1.3.x, 1.4.x +=================================================== Introduction ------------ @@ -16,6 +16,12 @@ the beginning of a project when your model is not totally defined and may change quiet often. (new tables, i18n, new columns, refactoring, tests...) +>**Note** +>Be carefull, using a symfony 1.4 sandbox doesnt' seems to work, better to start +>on a new generated project: +> +> `$symfony generate:project myPropelProject --orm=Propel` + Installation ------------ @@ -56,8 +62,10 @@ You can see all available options. We'll check all those options in detail later. So now let's try the basic conversion. (note that to use this basic syntax you must save your db4 schema in the `/doc/database/db4.xml` file as it is the -default value used by the plugin) +default value used by the plugin) + $ ./symfony propel:db4-to-propel frontend + A `schema.yml` is now in your `/config` directory. Let's open it, it should look like this: db4: @@ -116,22 +124,30 @@ #### Creating the database -Well if your are used to symfony, it will be very fast. Create a *db4* database and edit the following files: +Well if your are used to symfony, it will be very fast. Create a *db4* database +and edit the following configuration files: # propel.ini: - propel.database.createUrl = mysql:dbname=db4;host=localhost - propel.database.url = mysql:dbname=db4;host=localhost + propel.database.url = mysql:dbname=db4;host=localhost + propel.database.creole.url = ${propel.database.url} + propel.disableIdentifierQuoting = true # databases.yml: all: propel: - class: sfPropelDatabase + class: sfPropelDatabase param: - dsn: mysql:dbname=db4;host=localhost + classname: PropelPDO + dsn: mysql:dbname=db4;host=localhost + username: root + password: null + encoding: utf8 + persistent: true + pooling: true Ok now run propel-build-all: - $ ./symfony propel:build-all-load frontend + $ ./symfony propel:build-all-load --no-confirmation Check you lib folder, it should look like this: @@ -186,8 +202,9 @@ $ rm -rf lib/model $ rm -rf lib/forms + $ rm -rf lib/filters $ ./symfony propel:db4-to-propel frontend --package=lib.sfDB4toPropel - $ ./symfony propel:build-all-load frontend + $ ./symfony propel:build-all-load Refresh, now we have the following directories in our lib folder. Also check that we have our 3 tables in the db4 database. @@ -237,7 +254,7 @@ Default value : **null** -#### task shell +#### Task shell In the /bin folder of the plugin you have a small sh script called db4.sh that allows you to run all the tasks without to take care of the arguments. Copy this Added: plugins/sfDB4toPropelPlugin/branches/1.2/doc/database/db4.xml =================================================================== --- plugins/sfDB4toPropelPlugin/branches/1.2/doc/database/db4.xml (rev 0) +++ plugins/sfDB4toPropelPlugin/branches/1.2/doc/database/db4.xml 2010-04-12 15:45:00 UTC (rev 29090) @@ -0,0 +1,316 @@ +<?xml version="1.0" standalone="yes" ?> +<DBMODEL Version="4.0"> +<SETTINGS> +<GLOBALSETTINGS ModelName="propel" IDModel="0" IDVersion="0" VersionStr="1.0.0.0" Comments="" UseVersionHistroy="1" AutoIncVersion="1" DatabaseType="MySQL" ZoomFac="100.00" XPos="0" YPos="0" DefaultDataType="5" DefaultTablePrefix="0" DefSaveDBConn="" DefSyncDBConn="" DefQueryDBConn="" Printer="" HPageCount="4.0" PageAspectRatio="1.440892512336408" PageOrientation="1" PageFormat="A4 (210x297 mm, 8.26x11.7 inches)" SelectedPages="" UsePositionGrid="0" PositionGridX="20" PositionGridY="20" TableNameInRefs="1" DefaultTableType="0" ActivateRefDefForNewRelations="1" FKPrefix="" FKPostfix="" CreateFKRefDefIndex="1" DBQuoteCharacter="`" CreateSQLforLinkedObjects="0" DefModelFont="Tahoma" CanvasWidth="4096" CanvasHeight="2842" /> +<DATATYPEGROUPS> +<DATATYPEGROUP Name="Numeric Types" Icon="1" /> +<DATATYPEGROUP Name="Date and Time Types" Icon="2" /> +<DATATYPEGROUP Name="String Types" Icon="3" /> +<DATATYPEGROUP Name="Blob and Text Types" Icon="4" /> +<DATATYPEGROUP Name="User defined Types" Icon="5" /> +<DATATYPEGROUP Name="Geographic Types" Icon="6" /> +</DATATYPEGROUPS> +<DATATYPES> +<DATATYPE ID="1" IDGroup="0" TypeName="TINYINT" Description="A very small integer. The signed range is -128 to 127. The unsigned range is 0 to 255." ParamCount="1" OptionCount="2" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +<PARAMS> +<PARAM Name="length" /> +</PARAMS> +<OPTIONS> +<OPTION Name="UNSIGNED" Default="1" /> +<OPTION Name="ZEROFILL" Default="0" /> +</OPTIONS> +</DATATYPE> +<DATATYPE ID="2" IDGroup="0" TypeName="SMALLINT" Description="A small integer. The signed range is -32768 to 32767. The unsigned range is 0 to 65535." ParamCount="1" OptionCount="2" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +<PARAMS> +<PARAM Name="length" /> +</PARAMS> +<OPTIONS> +<OPTION Name="UNSIGNED" Default="1" /> +<OPTION Name="ZEROFILL" Default="0" /> +</OPTIONS> +</DATATYPE> +<DATATYPE ID="3" IDGroup="0" TypeName="MEDIUMINT" Description="A medium-size integer. The signed range is -8388608 to 8388607. The unsigned range is 0 to 16777215." ParamCount="1" OptionCount="2" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +<PARAMS> +<PARAM Name="length" /> +</PARAMS> +<OPTIONS> +<OPTION Name="UNSIGNED" Default="1" /> +<OPTION Name="ZEROFILL" Default="0" /> +</OPTIONS> +</DATATYPE> +<DATATYPE ID="4" IDGroup="0" TypeName="INT" Description="A normal-size integer. The signed range is -2147483648 to 2147483647. The unsigned range is 0 to 4294967295." ParamCount="1" OptionCount="2" ParamRequired="0" EditParamsAsString="0" SynonymGroup="1" PhysicalMapping="0" PhysicalTypeName="" > +<PARAMS> +<PARAM Name="length" /> +</PARAMS> +<OPTIONS> +<OPTION Name="UNSIGNED" Default="0" /> +<OPTION Name="ZEROFILL" Default="0" /> +</OPTIONS> +</DATATYPE> +<DATATYPE ID="5" IDGroup="0" TypeName="INTEGER" Description="A normal-size integer. The signed range is -2147483648 to 2147483647. The unsigned range is 0 to 4294967295." ParamCount="1" OptionCount="2" ParamRequired="0" EditParamsAsString="0" SynonymGroup="1" PhysicalMapping="0" PhysicalTypeName="" > +<PARAMS> +<PARAM Name="length" /> +</PARAMS> +<OPTIONS> +<OPTION Name="UNSIGNED" Default="1" /> +<OPTION Name="ZEROFILL" Default="0" /> +</OPTIONS> +</DATATYPE> +<DATATYPE ID="6" IDGroup="0" TypeName="BIGINT" Description="A large integer. The signed range is -9223372036854775808 to 9223372036854775807. The unsigned range is 0 to 18446744073709551615." ParamCount="1" OptionCount="2" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +<PARAMS> +<PARAM Name="length" /> +</PARAMS> +<OPTIONS> +<OPTION Name="UNSIGNED" Default="0" /> +<OPTION Name="ZEROFILL" Default="0" /> +</OPTIONS> +</DATATYPE> +<DATATYPE ID="7" IDGroup="0" TypeName="FLOAT" Description="A small (single-precision) floating-point number. Cannot be unsigned. Allowable values are -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to 3.402823466E+38." ParamCount="1" OptionCount="1" ParamRequired="1" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +<PARAMS> +<PARAM Name="precision" /> +</PARAMS> +<OPTIONS> +<OPTION Name="ZEROFILL" Default="0" /> +</OPTIONS> +</DATATYPE> +<DATATYPE ID="8" IDGroup="0" TypeName="FLOAT" Description="A small (single-precision) floating-point number. Cannot be unsigned. Allowable values are -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to 3.402823466E+38." ParamCount="2" OptionCount="1" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +<PARAMS> +<PARAM Name="length" /> +<PARAM Name="decimals" /> +</PARAMS> +<OPTIONS> +<OPTION Name="ZEROFILL" Default="0" /> +</OPTIONS> +</DATATYPE> +<DATATYPE ID="9" IDGroup="0" TypeName="DOUBLE" Description="A normal-size (double-precision) floating-point number. Cannot be unsigned. Allowable values are -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and 2.2250738585072014E-308 to 1.7976931348623157E+308." ParamCount="2" OptionCount="1" ParamRequired="0" EditParamsAsString="0" SynonymGroup="2" PhysicalMapping="0" PhysicalTypeName="" > +<PARAMS> +<PARAM Name="length" /> +<PARAM Name="decimals" /> +</PARAMS> +<OPTIONS> +<OPTION Name="ZEROFILL" Default="0" /> +</OPTIONS> +</DATATYPE> +<DATATYPE ID="10" IDGroup="0" TypeName="DOUBLE PRECISION" Description="This is a synonym for DOUBLE." ParamCount="2" OptionCount="1" ParamRequired="0" EditParamsAsString="0" SynonymGroup="2" PhysicalMapping="0" PhysicalTypeName="" > +<PARAMS> +<PARAM Name="length" /> +<PARAM Name="decimals" /> +</PARAMS> +<OPTIONS> +<OPTION Name="ZEROFILL" Default="0" /> +</OPTIONS> +</DATATYPE> +<DATATYPE ID="11" IDGroup="0" TypeName="REAL" Description="This is a synonym for DOUBLE." ParamCount="2" OptionCount="1" ParamRequired="0" EditParamsAsString="0" SynonymGroup="2" PhysicalMapping="0" PhysicalTypeName="" > +<PARAMS> +<PARAM Name="length" /> +<PARAM Name="decimals" /> +</PARAMS> +<OPTIONS> +<OPTION Name="ZEROFILL" Default="0" /> +</OPTIONS> +</DATATYPE> +<DATATYPE ID="12" IDGroup="0" TypeName="DECIMAL" Description="An unpacked floating-point number. Cannot be unsigned. Behaves like a CHAR column." ParamCount="2" OptionCount="1" ParamRequired="0" EditParamsAsString="0" SynonymGroup="3" PhysicalMapping="0" PhysicalTypeName="" > +<PARAMS> +<PARAM Name="length" /> +<PARAM Name="decimals" /> +</PARAMS> +<OPTIONS> +<OPTION Name="ZEROFILL" Default="0" /> +</OPTIONS> +</DATATYPE> +<DATATYPE ID="13" IDGroup="0" TypeName="NUMERIC" Description="This is a synonym for DECIMAL." ParamCount="2" OptionCount="1" ParamRequired="1" EditParamsAsString="0" SynonymGroup="3" PhysicalMapping="0" PhysicalTypeName="" > +<PARAMS> +<PARAM Name="length" /> +<PARAM Name="decimals" /> +</PARAMS> +<OPTIONS> +<OPTION Name="ZEROFILL" Default="0" /> +</OPTIONS> +</DATATYPE> +<DATATYPE ID="14" IDGroup="1" TypeName="DATE" Description="A date. The supported range is \a1000-01-01\a to \a9999-12-31\a." ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +<DATATYPE ID="15" IDGroup="1" TypeName="DATETIME" Description="A date and time combination. The supported range is \a1000-01-01 00:00:00\a to \a9999-12-31 23:59:59\a." ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +<DATATYPE ID="16" IDGroup="1" TypeName="TIMESTAMP" Description="A timestamp. The range is \a1970-01-01 00:00:00\a to sometime in the year 2037. The length can be 14 (or missing), 12, 10, 8, 6, 4, or 2 representing YYYYMMDDHHMMSS, ... , YYYYMMDD, ... , YY formats." ParamCount="1" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +<PARAMS> +<PARAM Name="length" /> +</PARAMS> +</DATATYPE> +<DATATYPE ID="17" IDGroup="1" TypeName="TIME" Description="A time. The range is \a-838:59:59\a to \a838:59:59\a." ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +<DATATYPE ID="18" IDGroup="1" TypeName="YEAR" Description="A year in 2- or 4-digit format (default is 4-digit)." ParamCount="1" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +<PARAMS> +<PARAM Name="length" /> +</PARAMS> +</DATATYPE> +<DATATYPE ID="19" IDGroup="2" TypeName="CHAR" Description="A fixed-length string (1 to 255 characters) that is always right-padded with spaces to the specified length when stored. values are sorted and compared in case-insensitive fashion according to the default character set unless the BINARY keyword is given." ParamCount="1" OptionCount="1" ParamRequired="1" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +<PARAMS> +<PARAM Name="length" /> +</PARAMS> +<OPTIONS> +<OPTION Name="BINARY" Default="0" /> +</OPTIONS> +</DATATYPE> +<DATATYPE ID="20" IDGroup="2" TypeName="VARCHAR" Description="A variable-length string (1 to 255 characters). Values are sorted and compared in case-sensitive fashion unless the BINARY keyword is given." ParamCount="1" OptionCount="1" ParamRequired="1" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +<PARAMS> +<PARAM Name="length" /> +</PARAMS> +<OPTIONS> +<OPTION Name="BINARY" Default="0" /> +</OPTIONS> +</DATATYPE> +<DATATYPE ID="21" IDGroup="2" TypeName="BIT" Description="This is a synonym for CHAR(1)." ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +<DATATYPE ID="22" IDGroup="2" TypeName="BOOL" Description="This is a synonym for CHAR(1)." ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +<DATATYPE ID="23" IDGroup="3" TypeName="TINYBLOB" Description="A column maximum length of 255 (2^8 - 1) characters. Values are sorted and compared in case-sensitive fashion." ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +<DATATYPE ID="24" IDGroup="3" TypeName="BLOB" Description="A column maximum length of 65535 (2^16 - 1) characters. Values are sorted and compared in case-sensitive fashion." ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +<DATATYPE ID="25" IDGroup="3" TypeName="MEDIUMBLOB" Description="A column maximum length of 16777215 (2^24 - 1) characters. Values are sorted and compared in case-sensitive fashion." ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +<DATATYPE ID="26" IDGroup="3" TypeName="LONGBLOB" Description="A column maximum length of 4294967295 (2^32 - 1) characters. Values are sorted and compared in case-sensitive fashion." ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +<DATATYPE ID="27" IDGroup="3" TypeName="TINYTEXT" Description="A column maximum length of 255 (2^8 - 1) characters." ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +<DATATYPE ID="28" IDGroup="3" TypeName="TEXT" Description="A column maximum length of 65535 (2^16 - 1) characters." ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +<DATATYPE ID="29" IDGroup="3" TypeName="MEDIUMTEXT" Description="A column maximum length of 16777215 (2^24 - 1) characters." ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +<DATATYPE ID="30" IDGroup="3" TypeName="LONGTEXT" Description="A column maximum length of 4294967295 (2^32 - 1) characters." ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +<DATATYPE ID="31" IDGroup="3" TypeName="ENUM" Description="An enumeration. A string object that can have only one value, chosen from the list of values." ParamCount="1" OptionCount="0" ParamRequired="1" EditParamsAsString="1" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +<PARAMS> +<PARAM Name="values" /> +</PARAMS> +</DATATYPE> +<DATATYPE ID="32" IDGroup="3" TypeName="SET" Description="A set. A string object that can have zero or more values, each of which must be chosen from the list of values." ParamCount="1" OptionCount="0" ParamRequired="1" EditParamsAsString="1" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +<PARAMS> +<PARAM Name="values" /> +</PARAMS> +</DATATYPE> +<DATATYPE ID="33" IDGroup="4" TypeName="Varchar(20)" Description="" ParamCount="0" OptionCount="1" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +<OPTIONS> +<OPTION Name="BINARY" Default="0" /> +</OPTIONS> +</DATATYPE> +<DATATYPE ID="34" IDGroup="4" TypeName="Varchar(45)" Description="" ParamCount="0" OptionCount="1" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +<OPTIONS> +<OPTION Name="BINARY" Default="0" /> +</OPTIONS> +</DATATYPE> +<DATATYPE ID="35" IDGroup="4" TypeName="Varchar(255)" Description="" ParamCount="0" OptionCount="1" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +<OPTIONS> +<OPTION Name="BINARY" Default="0" /> +</OPTIONS> +</DATATYPE> +<DATATYPE ID="36" IDGroup="5" TypeName="GEOMETRY" Description="Geographic Datatype" ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +<DATATYPE ID="38" IDGroup="5" TypeName="LINESTRING" Description="Geographic Datatype" ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +<DATATYPE ID="39" IDGroup="5" TypeName="POLYGON" Description="Geographic Datatype" ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +<DATATYPE ID="40" IDGroup="5" TypeName="MULTIPOINT" Description="Geographic Datatype" ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +<DATATYPE ID="41" IDGroup="5" TypeName="MULTILINESTRING" Description="Geographic Datatype" ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +<DATATYPE ID="42" IDGroup="5" TypeName="MULTIPOLYGON" Description="Geographic Datatype" ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +<DATATYPE ID="43" IDGroup="5" TypeName="GEOMETRYCOLLECTION" Description="Geographic Datatype" ParamCount="0" OptionCount="0" ParamRequired="0" EditParamsAsString="0" SynonymGroup="0" PhysicalMapping="0" PhysicalTypeName="" > +</DATATYPE> +</DATATYPES> +<COMMON_DATATYPES> +<COMMON_DATATYPE ID="5" /> +<COMMON_DATATYPE ID="8" /> +<COMMON_DATATYPE ID="20" /> +<COMMON_DATATYPE ID="15" /> +<COMMON_DATATYPE ID="22" /> +<COMMON_DATATYPE ID="28" /> +<COMMON_DATATYPE ID="26" /> +<COMMON_DATATYPE ID="33" /> +<COMMON_DATATYPE ID="34" /> +<COMMON_DATATYPE ID="35" /> +</COMMON_DATATYPES> +<TABLEPREFIXES> +<TABLEPREFIX Name="Defaut (pas de pr\233fixe)" /> +</TABLEPREFIXES> +<REGIONCOLORS> +<REGIONCOLOR Color="Red=#FFEEEC" /> +<REGIONCOLOR Color="Yellow=#FEFDED" /> +<REGIONCOLOR Color="Green=#EAFFE5" /> +<REGIONCOLOR Color="Cyan=#ECFDFF" /> +<REGIONCOLOR Color="Blue=#F0F1FE" /> +<REGIONCOLOR Color="Magenta=#FFEBFA" /> +</REGIONCOLORS> +<POSITIONMARKERS> +<POSITIONMARKER ZoomFac="-1.0" X="0" Y="0" /> +<POSITIONMARKER ZoomFac="-1.0" X="0" Y="0" /> +<POSITIONMARKER ZoomFac="-1.0" X="0" Y="0" /> +<POSITIONMARKER ZoomFac="-1.0" X="0" Y="0" /> +<POSITIONMARKER ZoomFac="-1.0" X="0" Y="0" /> +<POSITIONMARKER ZoomFac="-1.0" X="0" Y="0" /> +<POSITIONMARKER ZoomFac="-1.0" X="0" Y="0" /> +<POSITIONMARKER ZoomFac="-1.0" X="0" Y="0" /> +<POSITIONMARKER ZoomFac="-1.0" X="0" Y="0" /> +<POSITIONMARKER ZoomFac="-1.0" X="0" Y="0" /> +<POSITIONMARKER ZoomFac="-1.0" X="0" Y="0" /> +</POSITIONMARKERS> +</SETTINGS> +<METADATA> +<REGIONS> +<REGION ID="1009" RegionName="sfDB4ToPropelPlugin" XPos="123" YPos="68" Width="557" Height="416" RegionColor="4" TablePrefix="0" TableType="0" OverwriteTablePrefix="0" OverwriteTableType="0" Comments="" IsLinkedObject="0" IDLinkedModel="-1" Obj_id_Linked="-1" OrderPos="3" /> +</REGIONS> +<TABLES> +<TABLE ID="1000" Tablename="posts" PrevTableName="Table_01" XPos="337" YPos="194" TableType="1" TablePrefix="0" nmTable="0" Temporary="0" UseStandardInserts="0" StandardInserts="\n" TableOptions="DelayKeyTblUpdates=0\nPackKeys=0\nRowChecksum=0\nRowFormat=0\nUseRaid=0\nRaidType=0\n" Comments="myPost" Collapsed="0" IsLinkedObject="0" IDLinkedModel="-1" Obj_id_Linked="-1" OrderPos="2" > +<COLUMNS> +<COLUMN ID="1002" ColName="id" PrevColName="" Pos="0" idDatatype="5" DatatypeParams="" Width="-1" Prec="-1" PrimaryKey="1" NotNull="1" AutoInc="1" IsForeignKey="0" DefaultValue="" Comments="Primary Key"> +<OPTIONSELECTED> +<OPTIONSELECT Value="1" /> +<OPTIONSELECT Value="0" /> +</OPTIONSELECTED> +</COLUMN> +<COLUMN ID="1004" ColName="title" PrevColName="" Pos="1" idDatatype="20" DatatypeParams="(255)" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Title of post"> +<OPTIONSELECTED> +<OPTIONSELECT Value="0" /> +</OPTIONSELECTED> +</COLUMN> +<COLUMN ID="1005" ColName="content" PrevColName="" Pos="2" idDatatype="28" DatatypeParams="" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Full content of post"> +<OPTIONSELECTED> +</OPTIONSELECTED> +</COLUMN> +<COLUMN ID="1006" ColName="created_at" PrevColName="" Pos="3" idDatatype="16" DatatypeParams="" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Creation date of post"> +<OPTIONSELECTED> +</OPTIONSELECTED> +</COLUMN> +<COLUMN ID="1007" ColName="updated_at" PrevColName="" Pos="4" idDatatype="16" DatatypeParams="" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Update date of post"> +<OPTIONSELECTED> +</OPTIONSELECTED> +</COLUMN> +</COLUMNS> +<INDICES> +<INDEX ID="1003" IndexName="PRIMARY" IndexKind="0" FKRefDef_Obj_id="-1"> +<INDEXCOLUMNS> +<INDEXCOLUMN idColumn="1002" LengthParam="0" /> +</INDEXCOLUMNS> +</INDEX> +</INDICES> +</TABLE> +</TABLES> +<RELATIONS> +</RELATIONS> +<NOTES> +</NOTES> +<IMAGES> +</IMAGES> +</METADATA> +<PLUGINDATA> +<PLUGINDATARECORDS> +</PLUGINDATARECORDS> +</PLUGINDATA> +<QUERYDATA> +<QUERYRECORDS> +</QUERYRECORDS> +</QUERYDATA> +<LINKEDMODELS> +</LINKEDMODELS> +</DBMODEL> Modified: plugins/sfDB4toPropelPlugin/branches/1.2/lib/task/sfDB4toPropelTask.class.php =================================================================== --- plugins/sfDB4toPropelPlugin/branches/1.2/lib/task/sfDB4toPropelTask.class.php 2010-04-12 15:12:01 UTC (rev 29089) +++ plugins/sfDB4toPropelPlugin/branches/1.2/lib/task/sfDB4toPropelTask.class.php 2010-04-12 15:45:00 UTC (rev 29090) @@ -2,15 +2,15 @@ /** * Task Transforms the DB Designer4 XML schema to a valid Propel schema.xml file. - * + * * Automatically transforms: * - boolean * - i18n tables * - object name (table comment in the db4 application) * - database Propel name (model name in the model options of db4) * - model package directory - * - * @author loic.vernet - COil - <[email protected]> + * + * @author loic.vernet - COil - <[email protected]> * @since 1.0.0 - 30 july 08 */ @@ -36,7 +36,7 @@ $this->addArguments(array( new sfCommandArgument('application', sfCommandArgument::REQUIRED, 'The application name'), )); - + $this->addOptions(array( new sfCommandOption('env', null, sfCommandOption::PARAMETER_OPTIONAL, 'The environment name', self::DEFAULT_ENV_OPTION), new sfCommandOption('debug', null, sfCommandOption::PARAMETER_OPTIONAL, 'Enable debug', self::DEFAULT_DEBUG_OPTION), @@ -59,7 +59,7 @@ Quick version: --> [./symfony propel:db4-to-propel frontend|INFO] - + Full version: --> [./symfony propel:db4-to-propel frontend --env=cli --debug=1 --file_dir=/doc/database --file=db4.xml --output_dir=/config --output=schema --package=lib.model.forums --external_tables=sf_guard_user|INFO] @@ -74,7 +74,7 @@ // Chek parameters $this->setClassOptions($arguments, $options); $this->checkParameters(); - + // 0 - Start $this->logSection('START'); $message = ' - Start time: '. $this->getCurrentDateTime(); @@ -85,10 +85,10 @@ // 2 - Write new shema.xml $this->writeSchema(); - + // 3 - Convert to yml $this->convertSchemaToYml(); - + // 4 - End $this->logSection('END'); $message = ' - End time: '. $this->getCurrentDateTime(); @@ -97,14 +97,14 @@ /** * Check parameters and raise at the first incorrect one. - * + * * @return Exception */ protected function checkParameters($arguments = array(), $options = array()) { // Check DB4 input file $this->file_path = sfConfig::get('sf_root_dir'). $this->file_dir. '/'. $this->file; - + if (!file_exists($this->file_path) || !is_readable($this->file_path)) { throw new InvalidArgumentException(sprintf('The db4 file can\'t be found at %s, please check the path and correct the file_dir and file options.', $this->file_path)); @@ -121,25 +121,25 @@ * Transforms the DB4 schema to a Propel one. */ function doConvertSchema() - { - // XML + { + // XML $xml = new DomDocument(); $xml->loadXML(file_get_contents($this->file_path)); - + // DB4 xsl $db4_transformation_file = dirname(__FILE__). '/../vendor/db2/dbd2propel.xsl'; $xsl = new DomDocument(); $xsl->load($db4_transformation_file); - + // Attach the xsl rules $proc = new xsltprocessor(); - $proc->importStyleSheet($xsl); + $proc->importStyleSheet($xsl); $xmlstr = $proc->transformToXML($xml); - + // Automatised i18n $i18nlist = array(); preg_match_all('#\<table name=\"(.+)_i18n\"#', $xmlstr, $i18nlist); - + if (is_array($i18nlist) && isset($i18nlist[1]) && is_array($i18nlist[1])) { foreach ($i18nlist[1] as $tableName) @@ -155,7 +155,7 @@ // Others replacments $xmlstr = str_replace( array ( - // Add culture attribute + // Add culture attribute 'name="culture"', // Model package @@ -184,7 +184,7 @@ // Xml file save $this->xmlstr = $xmlstr; - $this->output_path = sfConfig::get('sf_root_dir'). $this->output_dir. '/'. $this->output. '.xml'; + $this->output_path = sfConfig::get('sf_root_dir'). $this->output_dir. '/'. $this->output. '.xml'; } /** @@ -208,13 +208,23 @@ { $filesystem = $this->getFilesystem(); $cmd = 'php '. sfConfig::get('sf_root_dir'). '/symfony propel:schema-to-yml'; - $filesystem->sh($cmd); + + // sh method was removed from symfony 1.4 + if (method_exists($filesystem, 'sh')) + { + $filesystem->sh($cmd); + } + else + { + sfFilesystem::execute($cmd); + } + $this->log(' - Database xml schema converted to yml.'); $filesystem->remove($this->output_path); $this->log(' - Database xml schema removed.'); } } - + /** * Return current formated date time to check task length. * Modified: plugins/sfDB4toPropelPlugin/branches/1.2/package.xml =================================================================== --- plugins/sfDB4toPropelPlugin/branches/1.2/package.xml 2010-04-12 15:12:01 UTC (rev 29089) +++ plugins/sfDB4toPropelPlugin/branches/1.2/package.xml 2010-04-12 15:45:00 UTC (rev 29090) @@ -5,28 +5,29 @@ <summary>The sfDB4toPropelPlugin allows to transform a DB4 schema into a valid Propel schema.yml file</summary> <description>sDB4toPropelPlugin is a plugin that adds to symfony a new task: propel:db4-to-propel that allows you to convert a DB4 schema (a DBDesigner4 schema) into a valid Propel schema.yml file, with this plugin you can just forget the boring work of building your schema.yml by hand. ;)</description> <lead> - <name>Vernet Loïc</name> + <name>Vernet Loic</name> <user>COil</user> <email>qrf_coil[at]yahoo[dot]fr</email> <active>yes</active> </lead> - <date>2009-05-04</date> + <date>2010-04-12</date> <time>14:55:55</time> <version> - <release>1.0.4</release> - <api>1.0.4</api> + <release>1.0.5</release> + <api>1.0.5</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> <license uri="http://www.symfony-project.com/license">MIT license</license> - <notes>This is the 1st version of the plugin for symfony 1.2.x</notes> + <notes>-</notes> <contents> <dir name="/"> <file name="bin/db4.sh" role="data" /> <file name="lib/task/sfDB4toPropelTask.class.php" role="data" /> <file name="lib/vendor/db2/dbd2propel.xsl" role="data" /> + <file name="doc/database/db4.xml" role="data" /> <file name="LICENSE" role="data" /> <file name="README" role="data" /> </dir> @@ -43,8 +44,8 @@ <name>symfony</name> <channel>pear.symfony-project.com</channel> <min>1.2.0</min> - <max>1.3.0</max> - <exclude>1.3.0</exclude> + <max>1.5.0</max> + <exclude>1.5.0</exclude> </package> </required> </dependencies> @@ -52,6 +53,22 @@ <changelog> <release> <version> + <release>1.0.5</release> + <api>1.0.5</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <license uri="http://www.symfony-project.com/license">MIT license</license> + <date>2010-04-12</date> + <license>MIT</license> + <notes> + * Updated plugin for symfony 1.3 and 1.4 + </notes> + </release> + <release> + <version> <release>1.0.4</release> <api>1.0.4</api> </version> -- You received this message because you are subscribed to the Google Groups "symfony SVN" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/symfony-svn?hl=en.
