public function testColumnConvert()
 {
     $order = new OrderBundle\Model\Order();
     $schema = $order->getSchema();
     $this->assertNotNull($schema);
     $action = ColumnConvert::convertSchemaToAction($schema, $order);
     $this->assertNotNull($action);
     $this->assertInstanceOf('ActionKit\\Action', $action);
     $this->assertInstanceOf('ActionKit\\RecordAction\\BaseRecordAction', $action);
     $view = $action->asView('ActionKit\\View\\StackView');
     $this->assertNotNull($view);
     $this->assertInstanceOf('ActionKit\\View\\StackView', $view);
 }
Example #2
0
 /**
  * Set record
  *
  * @param Phifty\Model $record
  */
 public function setRecord(BaseModel $record)
 {
     $this->record = $record;
     // Convert id column object from record schema to
     // Action param object.
     if ($column = $this->record->getColumn('id')) {
         if (!isset($this->params[$column->name])) {
             $this->params[$column->name] = ColumnConvert::toParam($column, $record, $this);
         }
     }
     // build relationship config from model schema
     if ($relations = $this->record->getSchema()->relations) {
         foreach ($relations as $rId => $relation) {
             $this->addRelation($rId, $relation);
         }
     }
 }