Changeset 7845
- Timestamp:
- 03/12/08 23:36:14 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/sfFormPropel.class.php
r7275 r7845 42 42 public function __construct(BaseObject $object = null, $options = array(), $CSRFSecret = null) 43 43 { 44 $class = $this->getModelName(); 44 45 if (is_null($object)) 45 46 { 46 $class = $this->getModelName();47 47 $this->object = new $class(); 48 48 } 49 49 else 50 50 { 51 if ( $this->getModelName() != get_class($object))51 if (!$object instanceof $class) 52 52 { 53 throw new sfException(sprintf('The "%s" form only accepts a "%s" object.', get_class($this), $ this->getModelName()));53 throw new sfException(sprintf('The "%s" form only accepts a "%s" object.', get_class($this), $class)); 54 54 } 55 55 … … 71 71 { 72 72 return Propel::getConnection(constant(sprintf('%sPeer::DATABASE_NAME', $this->getModelName()))); 73 return Propel::getConnection(constant(sprintf('%s::DATABASE_NAME', get_class($this->object->getPeer())))); 73 74 } 74 75