[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 3 /* 4 * $Id: PropelDataDTDTask.php 64 2005-05-13 02:43:56Z root $ 5 * 6 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 7 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 8 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 9 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 10 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 11 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 12 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 13 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 14 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 15 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 16 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 17 * 18 * This software consists of voluntary contributions made by many individuals 19 * and is licensed under the LGPL. For more information please see 20 * <http://propel.phpdb.org>. 21 */ 22 23 require_once 'propel/phing/AbstractPropelDataModelTask.php'; 24 include_once 'propel/engine/builder/om/ClassTools.php'; 25 26 /** 27 * This Task creates the OM classes based on the XML schema file. 28 * 29 * @author Hans Lellelid <hans@xmpl.org> 30 * @package propel.phing 31 */ 32 class PropelDataDTDTask extends AbstractPropelDataModelTask { 33 34 35 public function main() { 36 37 // check to make sure task received all correct params 38 $this->validate(); 39 40 if(!$this->mapperElement) { 41 throw new BuildException("You must use a <mapper/> element to describe how names should be transformed."); 42 } 43 44 $basepath = $this->getOutputDirectory(); 45 46 // Get new Capsule context 47 $generator = $this->createContext(); 48 $generator->put("basepath", $basepath); // make available to other templates 49 50 // we need some values that were loaded into the template context 51 $basePrefix = $generator->get('basePrefix'); 52 $project = $generator->get('project'); 53 54 foreach ($this->getDataModels() as $dataModel) { 55 56 $this->log("Processing Datamodel : " . $dataModel->getName()); 57 58 foreach ($dataModel->getDatabases() as $database) { 59 60 $outFile = $this->getMappedFile($dataModel->getName()); 61 62 $generator->put("tables", $database->getTables()); 63 $generator->parse("data/dtd/dataset.tpl", $outFile->getAbsolutePath()); 64 65 $this->log("Generating DTD for database: " . $database->getName()); 66 $this->log("Creating DTD file: " . $outFile->getPath()); 67 68 foreach ($database->getTables() as $tbl) { 69 $this->log("\t + " . $tbl->getName()); 70 $generator->put("table", $tbl); 71 $generator->parse("data/dtd/table.tpl", $outFile->getAbsolutePath(), true); 72 } 73 74 } // foreach database 75 76 } // foreach dataModel 77 78 79 } // main() 80 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |