[ Index ]
 

Code source de Symfony 1.0.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/addon/propel/builder/ -> SfMapBuilderBuilder.php (source)

   1  <?php
   2  
   3  require_once 'propel/engine/builder/om/php5/PHP5MapBuilderBuilder.php';
   4  
   5  /*
   6   * This file is part of the symfony package.
   7   * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
   8   *
   9   * For the full copyright and license information, please view the LICENSE
  10   * file that was distributed with this source code.
  11   */
  12  
  13  /**
  14   * @package    symfony
  15   * @subpackage addon
  16   * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
  17   * @version    SVN: $Id: SfMapBuilderBuilder.php 3058 2006-12-16 17:17:26Z fabien $
  18   */
  19  class SfMapBuilderBuilder extends PHP5MapBuilderBuilder
  20  {
  21    public function build()
  22    {
  23      if (!DataModelBuilder::getBuildProperty('builderAddComments'))
  24      {
  25        return sfToolkit::stripComments(parent::build());
  26      }
  27      
  28      return parent::build();
  29    }
  30  
  31    protected function addIncludes(&$script)
  32    {
  33      if (!DataModelBuilder::getBuildProperty('builderAddIncludes'))
  34      {
  35        return;
  36      }
  37  
  38      parent::addIncludes($script);
  39    }
  40  
  41    protected function addDoBuild(&$script)
  42    {
  43      parent::addDoBuild($script);
  44  
  45      // fix http://propel.phpdb.org/trac/ticket/235: Column sizes not being inserted into [table]MapBuilder->DoBuild() by PHP5MapBuilderBuilder
  46      $sizes = array();
  47      foreach ($this->getTable()->getColumns() as $col)
  48      {
  49        $sizes[$col->getPhpName()] = !$col->getSize() ? 'null' : $col->getSize();
  50      }
  51      $script = preg_replace("/\\\$tMap\->addColumn\('([^']+)', '([^']+)', '([^']+)', CreoleTypes\:\:VARCHAR, (false|true)\)/e", '"\\\$tMap->addColumn(\'$1\', \'$2\', \'$3\', CreoleTypes::VARCHAR, $4, {$sizes[\'$2\']})"', $script);
  52    }
  53  }


Généré le : Fri Mar 16 22:42:14 2007 par Balluche grâce à PHPXref 0.7