PHP code example of cargomedia / cm
1. Go to this page and download the library: Download cargomedia/cm library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cargomedia / cm example snippets
$foo = new Foo(123);
protected function _getSchema() {
return new CM_Model_Schema_Definition(array(
'fieldA' => array('type' => 'int'),
'fieldB' => array('type' => 'string', 'optional' => true),
'fieldC' => array('type' => 'CM_Model_Example'),
));
}
public static function getPersistenceClass() {
return 'CM_Model_StorageAdapter_Database';
}
/**
* @return string|null
*/
public function getFieldB() {
return $this->_get('fieldB');
}
/**
* @param string|null $fieldB
*/
public function setFieldB($fieldB) {
$this->_set('fieldB', $fieldB);
}
/**
* @return CM_Model_Example
*/
public function getFieldC() {
return $this->_get('fieldC');
}
/**
* @param CM_Model_Example $fieldC
*/
public function setFieldC($fieldC) {
$this->_set('fieldC', $fieldC);
}
public static function getCacheClass() {
return 'CM_Model_StorageAdapter_CacheLocal';
}
$foo = new Foo();
$foo->setFieldA(23);
$foo->setFieldB('bar');
$foo->commit();
$foo = new Foo(123);
$foo->delete();
$foo = Foo::createStatic(array('fieldA' => 1, 'fieldB' => 'hello world'));
CM_Paging_<Type of item>_<Lookup description>
CM_Paging_Photo_User # All photos of a given user
CM_Paging_User_Country # All users from a given country
library/
└── CM
└── Payments
├── Accounting
│ ├── Account.php
│ ├── Transaction.php
│ └── TransactionList
│ ├── Abstract.php
│ └── User.php
├── Bank.php
├── BankList
│ ├── Abstract.php
│ ├── All.php
│ └── PaymentProvider.php
├── ExchangeRateUpdater.php
└── SetupScript.php
library/
└── CM
└── Component
└── Payments
├── AccountList.js
├── AccountList.php
├── TransactionList.js
└── TransactionList.php