[ Index ]
 

Code source de Symfony 1.0.0

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

title

Body

[fermer]

/lib/addon/propel/generator/ -> sfPropelAdminGenerator.class.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the symfony package.
   5   * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
   6   *
   7   * For the full copyright and license information, please view the LICENSE
   8   * file that was distributed with this source code.
   9   */
  10  
  11  /**
  12   * Propel Admin generator.
  13   *
  14   * This class generates an admin module with propel.
  15   *
  16   * @package    symfony
  17   * @subpackage generator
  18   * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
  19   * @version    SVN: $Id: sfPropelAdminGenerator.class.php 3302 2007-01-18 13:42:46Z fabien $
  20   */
  21  
  22  class sfPropelAdminGenerator extends sfPropelCrudGenerator
  23  {
  24    /**
  25     * Initializes the current sfGenerator instance.
  26     *
  27     * @param sfGeneratorManager A sfGeneratorManager instance
  28     */
  29    public function initialize($generatorManager)
  30    {
  31      parent::initialize($generatorManager);
  32  
  33      $this->setGeneratorClass('sfPropelAdmin');
  34    }
  35  
  36    public function getAllColumns()
  37    {
  38      $phpNames = array();
  39      foreach ($this->getTableMap()->getColumns() as $column)
  40      {
  41        $phpNames[] = new sfAdminColumn($column->getPhpName(), $column);
  42      }
  43  
  44      return $phpNames;
  45    }
  46  
  47    public function getAdminColumnForField($field, $flag = null)
  48    {
  49      $phpName = sfInflector::camelize($field);
  50  
  51      return new sfAdminColumn($phpName, $this->getColumnForPhpName($phpName), $flag);
  52    }
  53  
  54    // returns a column phpName or null if none was found
  55    public function getColumnForPhpName($phpName)
  56    {
  57      // search the matching column for this column name
  58  
  59      foreach ($this->getTableMap()->getColumns() as $column)
  60      {
  61        if ($column->getPhpName() == $phpName)
  62        {
  63          $found = true;
  64  
  65          return $column;
  66        }
  67      }
  68  
  69      // not a "real" column, so we will simulate one
  70      return null;
  71    }
  72  }


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