/** * Constructor * * @param ObjectConfig $config An optional ObjectConfig object with configuration options */ public function __construct(ObjectConfig $config) { parent::__construct($config); $this->_table = $config->table; // Set the static states $this->getState()->insert('limit', 'int')->insert('offset', 'int')->insert('sort', 'cmd')->insert('direction', 'word', 'asc')->insert('search', 'string'); // Set the dynamic states based on the unique table keys foreach ($this->getTable()->getUniqueColumns() as $key => $column) { $this->getState()->insert($key, $column->filter, null, true, $this->getTable()->mapColumns($column->related, true)); } }
/** * @since 4.8.1 * @param callable $data The {@link set_function() function} to give to the command. */ public function __construct($data = array()) { if (is_callable($data, true)) { $data = array('function' => $data); } if (isset($data['function'])) { $this->setFunction($data['function']); unset($data['function']); } if (isset($data['args'])) { $this->setArgs($data['args']); unset($data['args']); } parent::__construct($data); }
/** * Constructor * * @param ObjectConfig $config An optional ObjectConfig object with configuration options */ public function __construct(ObjectConfig $config) { parent::__construct($config); //Set the table identifier $this->setTable($config->table); //Calculate the aliases based on the location of the table $model = $database = $this->getTable()->getIdentifier()->toArray(); //Create database.rowset -> model.entity alias $database['path'] = array('database', 'rowset'); $model['path'] = array('model', 'entity'); $this->getObject('manager')->registerAlias($model, $database); //Create database.row -> model.entity alias $database['path'] = array('database', 'row'); $database['name'] = StringInflector::singularize($database['name']); $model['path'] = array('model', 'entity'); $model['name'] = StringInflector::singularize($model['name']); $this->getObject('manager')->registerAlias($model, $database); //Behavior depends on the database. Need to add if after database has been set. $this->addBehavior('indexable'); //Create the query before fetch and count $this->addCommandCallback('before.fetch', '_buildQuery'); $this->addCommandCallback('before.count', '_buildQuery'); }
/** * Constructor for ModelCustomer */ public function __construct() { parent::__construct(); $this->table = 'product'; $this->tableFieldsMap = array('id' => 'id', 'title' => 'title', 'price' => 'price', 'sku' => 'sku', 'code' => 'code', 'tax' => 'tax', 'image' => 'image'); }
/** * Constructor for ModelCustomer */ public function __construct() { parent::__construct(); $this->table = 'customer'; $this->tableFieldsMap = array('id' => 'id', 'created' => 'created', 'email' => 'email', 'hashedPassword' => 'hashedPassword', 'modified' => 'modified'); }
/** * Constructor * * @param ObjectConfig $config An optional ObjectConfig object with configuration options */ public function __construct(ObjectConfig $config) { parent::__construct($config); $this->_entity = $this->getObject('lib:model.entity.immutable'); }
/** * Constructor for ModelPayment */ public function __construct() { parent::__construct(); $this->table = 'payment'; $this->tableFieldsMap = array('VendorTxCode' => 'vendorTxCode', 'AddressResult' => 'addressResult', 'AddressStatus' => 'addressStatus', 'Amount' => 'amount', 'AVSCV2' => 'avsCv2', 'Basket' => 'basket', 'BasketXML' => 'basketXml', 'BillingAddress1' => 'billingAddress1', 'BillingAddress2' => 'billingAddress2', 'BillingCity' => 'billingCity', 'BillingCountry' => 'billingCountry', 'BillingFirstnames' => 'billingFirstnames', 'BillingPhone' => 'billingPhone', 'BillingPostCode' => 'billingPostCode', 'BillingState' => 'billingState', 'BillingSurname' => 'billingSurname', 'CapturedAmount' => 'capturedAmount', 'CardType' => 'cardType', 'CAVV' => 'cavv', 'CreateToken' => 'createToken', 'created' => 'created', 'Currency' => 'currency', 'CustomerEMail' => 'customerEmail', 'CV2Result' => 'cv2Result', 'DeliveryAddress1' => 'deliveryAddress1', 'DeliveryAddress2' => 'deliveryAddress2', 'DeliveryCity' => 'deliveryCity', 'DeliveryCountry' => 'deliveryCountry', 'DeliveryFirstnames' => 'deliveryFirstnames', 'DeliveryPhone' => 'deliveryPhone', 'DeliveryPostCode' => 'deliveryPostCode', 'DeliveryState' => 'deliveryState', 'DeliverySurname' => 'deliverySurname', 'ExpiryDate' => 'expiryDate', 'AllowGiftAid' => 'giftAid', 'Last4Digits' => 'last4Digits', 'modified' => 'modified', 'PayerId' => 'payerId', 'PayerStatus' => 'payerStatus', 'PostCodeResult' => 'postCodeResult', 'RelatedVendorTxCode' => 'relatedVendorTxCode', 'SecurityKey' => 'securityKey', 'Status' => 'status', 'StatusDetail' => 'statusMessage', 'Surcharge' => 'surcharge', '3DSecureStatus' => 'threeDSecureStatus', 'Token' => 'token', 'TxType' => 'transactionType', 'TxAuthNo' => 'txAuthNo', 'VPSTxId' => 'vpsTxId', 'BankAuthCode' => 'bankAuthCode', 'DeclineCode' => 'declineCode', 'FraudResponse' => 'fraudResponse'); }
/** * Constructor for ModelCard */ public function __construct() { parent::__construct(); $this->table = 'customercard'; $this->tableFieldsMap = array('id' => 'id', 'created' => 'created', 'last4digits' => 'last4digits', 'modified' => 'modified', 'token' => 'token', 'customer_id' => 'customer_id'); }