I try to insert the static value I have here
public static function saveBrandsAction()
{
$api = new Ns_Thorleif_Adminhtml_IndexController();
$arr = array();
$arr[] = array('brandId' => '123', 'name' => 'test', 'globalIdentifier' => '1020002020');
$model = Mage::getModel('thorleif/brand')->addData($arr);
var_dump($model);
try {
$insertId = $model->save()->getId();
echo "Data successfully inserted. Insert ID: ".$insertId;
} catch (Exception $e){
echo $e->getMessage();
}
}
but in the debug the query is like this
INSERT INTO `linio_brands` () VALUES ()
and my var dump looks like
object(Ns_Thorleif_Model_Brand)#314 (15) { ["_eventPrefix":protected]=> string(13) "core_abstract" ["_eventObject":protected]=> string(6) "object" ["_resourceName":protected]=> string(14) "thorleif/brand" ["_resource":protected]=> NULL ["_resourceCollectionName":protected]=> string(25) "thorleif/brand_collection" ["_cacheTag":protected]=> bool(false) ["_dataSaveAllowed":protected]=> bool(true) ["_isObjectNew":protected]=> NULL ["_data":protected]=> array(1) { [0]=> array(3) { ["brandId"]=> string(3) "123" ["name"]=> string(4) "test" ["globalIdentifier"]=> string(10) "1020002020" } } ["_hasDataChanges":protected]=> bool(true) ["_origData":protected]=> NULL ["_idFieldName":protected]=> NULL ["_isDeleted":protected]=> bool(false) ["_oldFieldsMap":protected]=> array(0) { } ["_syncFieldsMap":protected]=> array(0) { } } Data successfully inserted. Insert ID: 5
something is wrong?
$arr[]
to$arr