|
Revision 9134, 1.7 kB
(checked in by dwhittle, 5 years ago)
|
sfPropelPlugin: merged r9132 (phpdoc updates)
|
- Property svn:mime-type set to
text/x-php
- Property svn:eol-style set to
native
- Property svn:keywords set to
Id
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
class sfPropelAdminGenerator extends sfPropelCrudGenerator |
|---|
| 23 |
{ |
|---|
| 24 |
|
|---|
| 25 |
* Initializes the current sfGenerator instance. |
|---|
| 26 |
* |
|---|
| 27 |
* @param sfGeneratorManager $generatorManager A sfGeneratorManager instance |
|---|
| 28 |
*/ |
|---|
| 29 |
public function initialize(sfGeneratorManager $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 |
|
|---|
| 55 |
public function getColumnForPhpName($phpName) |
|---|
| 56 |
{ |
|---|
| 57 |
|
|---|
| 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 |
|
|---|
| 70 |
return null; |
|---|
| 71 |
} |
|---|
| 72 |
} |
|---|
| 73 |
|
|---|