Пример #1
0
 protected function getSchema()
 {
     $schema = new Elite_Vaf_Model_Schema();
     $schema->setConfig($this->getCOnfig());
     /** @todo potential linux bug needs regression test */
     return $schema;
 }
Пример #2
0
 function getSchema()
 {
     $schema = new Elite_Vaf_Model_Schema();
     if (!is_null($this->getConfig())) {
         $schema->setConfig($this->getConfig());
     }
     return $schema;
 }
Пример #3
0
 function save()
 {
     if (!(int) $this->product_id) {
         throw new Exception('Trying to insert a mapping with no product ID');
     }
     $schema = new Elite_Vaf_Model_Schema();
     $schema->setConfig($this->getConfig());
     $levels = $schema->getLevels();
     $select = $this->getReadAdapter()->select()->from('elite_mapping', array('id'));
     foreach ($this->vehicle->toValueArray() as $level => $id) {
         $select->where($this->inflect($level) . '_id = ?', $id);
     }
     $select->where('entity_id = ?', $this->product_id);
     $id = (int) $select->query()->fetchColumn();
     if (0 !== $id) {
         return $id;
     }
     $columns = '';
     $values = '';
     foreach ($levels as $level) {
         $columns .= '`' . $this->inflect($level) . '_id`,';
         $values .= $this->inflect($this->vehicle->getLevel($level)->getId());
         $values .= ',';
     }
     $query = sprintf('
         INSERT INTO
             `elite_mapping`
         (
             ' . $columns . '
             `entity_id`
         )
         VALUES
         (
             ' . $values . '
             %d
         )
         ', (int) $this->product_id);
     $r = $this->query($query);
     return $this->getReadAdapter()->lastInsertId();
 }
Пример #4
0
 function getDefaultLevel()
 {
     $schema = new Elite_Vaf_Model_Schema();
     $schema->setConfig($this->getConfig());
     return $schema->getRootLevel();
 }
Пример #5
0
 function getSchema()
 {
     $schema = new Elite_Vaf_Model_Schema();
     $schema->setConfig($this->getConfig());
     return $schema;
 }