Changeset 4753

Show
Ignore:
Timestamp:
08/07/08 20:46:31 (5 months ago)
Author:
jwage
Message:

fixes #1223

Location:
branches/1.0/lib/Doctrine/Import
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/1.0/lib/Doctrine/Import/Builder.php

    r4681 r4753  
    402402        } 
    403403 
     404        if (isset($definition['checks']) && is_array($definition['checks']) && !empty($definition['checks'])) { 
     405            $ret[$i] = $this->buildChecks($definition['checks']); 
     406            $i++; 
     407        } 
     408 
    404409        if (isset($definition['inheritance']['subclasses']) && ! empty($definition['inheritance']['subclasses'])) { 
    405410            $ret[$i] = "    ".'$this->setSubClasses('. $this->varExport($definition['inheritance']['subclasses']).');'; 
     
    493498 
    494499        if (isset($definition['listeners']) && is_array($definition['listeners']) && !empty($definition['listeners'])) { 
    495             foreach($definition['listeners'] as $listener) 
    496             { 
    497                 $ret[$i] = $this->buildListener($listener); 
    498                 $i++; 
    499             } 
     500            $ret[$i] = $this->buildListeners($definition['listeners']); 
     501            $i++; 
    500502        } 
    501503 
     
    517519            return '  public function setUp()' . PHP_EOL . '  {' . PHP_EOL . '    ' . $code . PHP_EOL . '  }'; 
    518520        } 
     521    } 
     522 
     523    /** 
     524     * Build php code for record checks 
     525     * 
     526     * @param array $checks 
     527     * @return string $build 
     528     */ 
     529    public function buildChecks($checks) 
     530    { 
     531        $build = ''; 
     532        foreach ($checks as $check) { 
     533            $build .= "    \$this->check('" . $check . "');" . PHP_EOL; 
     534        } 
     535        return $build; 
    519536    } 
    520537 
     
    743760    } 
    744761 
    745      /** 
    746      * buildListener 
    747      * 
    748      * @param string $listener 
    749      * @return string 
    750      */ 
    751     public function buildListener($listener) 
    752     { 
    753         return PHP_EOL."    ".'$this->addListener(new '.$listener.'());'; 
    754     } 
    755  
     762    /** 
     763     * Build php code for adding record listeners 
     764     * 
     765     * @param string $listeners  
     766     * @return string $build 
     767     */ 
     768    public function buildListeners($listeners) 
     769    { 
     770        $build = ''; 
     771        foreach($listeners as $listener) { 
     772            $build .= "    \$this->addListener(new " . $listener . "());" . PHP_EOL; 
     773        } 
     774 
     775        return $build; 
     776    } 
    756777 
    757778    /** 
  • branches/1.0/lib/Doctrine/Import/Schema.php

    r4728 r4753  
    8686                                                          'inheritance', 
    8787                                                          'detect_relations', 
    88                                                           'listeners'), 
     88                                                          'listeners', 
     89                                                          'checks'), 
    8990 
    9091                                   'column'     =>  array('name',