PHP code example of akawalko / zfext
1. Go to this page and download the library: Download akawalko/zfext 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/ */
akawalko / zfext example snippets
class Users extends ZFExt_Model_DbTable
{
protected $_name = 'users';
protected $_primary = 'user_id';
public function get($id, $useCache = true)
{
$select = $this->select()
->where('user_id = :user_id');
return $this->loadOne($select, array('user_id' => $id), null, $useCache, __METHOD__);
}
public function getAll($useCache = true)
{
$select = $this->select()
->where('is_active = :is_active');
return $this->loadAll($select, array('is_active' => 1), null, $useCache, __METHOD__);
}
}
/** Composer Autoloader **/
l', array(
'host' => '127.0.0.1',
'username' => 'your_db_user',
'password' => 'your_db_passord',
'dbname' => 'your_db_name'
));
$cache = Zend_Cache::factory('Core', 'APC', array(
'lifetime' => 3600,
'automatic_serialization' => true,
));
$userModel = new Users(array('db' => $db, 'cache' => $cache));
$users = $userModel->getAll();