I have recently upgraded to 1.2.4 and so far everything has worked  
quite well.

When I tried generate a admin module I ran in to a strange problem  
though. Having this doctrine schema:

Products:
   columns:
     id:
       primary: true
       autoincrement: true
       type: integer
     ean:
       type: string
     name:
       type: string
     state:
       type: integer
       default : 1
       notnull: true
     position:
       type: integer
       default : 1
       notnull: true
     location:
       type: string
       default :
     ordered:
       type: date
     delivered:
       type: date
     contact:
       type: string
     email:
       type: string
       email: true
     newpic:
       type: boolean
       default : true
   relations:
     State:
       class: States
       local: state
       foreign: id
     Position:
       class: Positions
       local: position
       foreign: id

States:
   columns:
     id:
       primary: true
       type: integer
       unique: true
     state:
       type: string

Positions:
   columns:
     id:
       primary: true
       type: integer
       unique: true
     position:
       type: string

and this fixture:

Positions:
   1:
     id: 1
     position: Mangler
   2:
     id: 2
     position: Hos fotograf
   3:
     id: 3
     position: På lager

States:
   state1:
     id: 1
     state: Mangler
   state2:
     id: 2
     state: Bestilt
   state3:
     id: 3
     state: På lager
   state4:
     id: 4
     state: Rekvirer
Products:
   product1:
     id: 1
     ean: 123456789012
     name: test product 1
     state: 1
     position: 1
     location:
     ordered: '2008-12-08'
     delivered: '2008-12-09'
     contact: somebody
     email: [email protected]
     newpic: false

I tried to generate  the admin with this command:

symfony doctrine:generate-admin frontend Products

but when I try to view the index of the module I get this error:

500 | Internal Server Error | Doctrine_Connection_Sqlite_Exception
SQLSTATE[HY000]: General error: 1 near "p": syntax error
stack trace

     * at ()
       in SF_SYMFONY_LIB_DIR/plugins/sfDoctrinePlugin/lib/vendor/ 
doctrine/Doctrine/Connection.php line 1076 ...
             1073.
             1074.         $name = 'Doctrine_Connection_' . $this- 
 >driverName . '_Exception';
             1075.
             1076.         $exc  = new $name($e->getMessage(), (int)  
$e->getCode());
             1077.         if ( ! isset($e->errorInfo) || !  
is_array($e->errorInfo)) {
             1078.             $e->errorInfo = array(null, null, null,  
null);
             1079.         }
     * at Doctrine_Connection- 
 >rethrowException(object('PDOException'),  
object('Doctrine_Connection_Sqlite'))
       in SF_SYMFONY_LIB_DIR/plugins/sfDoctrinePlugin/lib/vendor/ 
doctrine/Doctrine/Connection.php line 1024 ...
....
....
....


If I generate without the fixture it works until I try to add a entry.

if I run:

symfony doctrine:generate-admin frontend States

the admin works fine.

I have added these modification to the product model:

class ProductsFormFilter extends BaseProductsFormFilter
{
        public function configure()
        {
                $this->widgetSchema['ean'] = new  
sfWidgetFormFilterInput(array('with_empty' => false));
                $this->widgetSchema['name'] = new  
sfWidgetFormFilterInput(array('with_empty' => false));
                $this->widgetSchema['location'] = new  
sfWidgetFormFilterInput(array('with_empty' => false));
        }
}

class ProductsForm extends BaseProductsForm
{
        public function configure()
        {
                $this->widgetSchema['location'] = new sfWidgetFormInput();
                unset($this['ordered']);
                unset($this['delivered']);
                unset($this['contact']);
                unset($this['email']);
                unset($this['name']);
                unset($this['ean']);
        }
}

class Products extends BaseProducts
{
     public function getStateAsText(){
         return $this->getState();
     }

     public function getPositionAsText(){
         return $this->getPosition();
     }

     public function postUpdate($event)
     {
         if($this->getState() == "På lager" && $this->getNewpic() ==  
true){
            $this->setDelivered(date('Y-m-d',time()));
            $this->save();
         }
     }
}

Hope somebody has a clue...

Joe







--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to