本文整理汇总了PHP中SimpleORMap::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleORMap::__construct方法的具体用法?PHP SimpleORMap::__construct怎么用?PHP SimpleORMap::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleORMap
的用法示例。
在下文中一共展示了SimpleORMap::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Initialize a new directory entry object for the given id.
*
* @param string $id directory entry id
* @throws InvalidArgumentException if id of directory entry is invalid
*/
public function __construct($id = null)
{
parent::__construct($id);
if ($id !== null && $this->isNew()) {
throw new InvalidArgumentException('directory entry not found');
}
}
示例2: __construct
/**
* Give primary key of record as param to fetch
* corresponding record from db if available, if not preset primary key
* with given value. Give null to create new record
*
* @param mixed $id primary key of table
*/
public function __construct($id = null)
{
$this->db_table = 'seminar_tabs';
$this->belongs_to['course'] = array('class_name' => '\\Course', 'foreign_key' => 'seminar_id');
// workaround for Stud.IP ticket:5312
//$options = $this->getRelationOptions('course');
//$options = $this->getRelationOptions('parent');
/**
$this->has_many['children'] = array(
'class_name' => 'Mooc\\DB\\Block',
'assoc_foreign_key' => 'parent_id',
'assoc_func' => 'findByParent_id',
'on_delete' => 'delete',
'on_store' => 'store'
);
$this->registerCallback('before_create', 'ensureSeminarId');
$this->registerCallback('before_create', 'ensurePositionId');
$this->registerCallback('before_store', 'validate');
$this->registerCallback('after_delete', 'destroyFields');
$this->registerCallback('after_delete', 'destroyUserProgress');
$this->registerCallback('after_delete', 'updatePositionsAfterDelete');
$events = words('after_create after_update after_store after_delete');
$this->registerCallback($events, 'callbackToMetrics');
**/
parent::__construct($id);
}
示例3:
function __construct($id = null)
{
$this->db_table = 'blubber_external_contact';
//$this->registerCallback('before_store', 'cbSerializeData');
//$this->registerCallback('after_store after_initialize', 'cbUnserializeData');
parent::__construct($id);
}
示例4: __construct
public function __construct($id = null)
{
$this->db_table = 'doc_filetype_forbidden';
$this->belongs_to['userConfig'] = array('class_name' => 'DocUsergroupConfig', 'foreign_key' => 'usergroup');
$this->belongs_to['filetype'] = array('class_name' => 'DocFiletype', 'foreign_key' => 'dateityp_id');
parent::__construct($id);
}
示例5:
function __construct($id = null)
{
if (version_compare($GLOBALS['SOFTWARE_VERSION'], "3.2", "<")) {
$this->registerCallback('before_store', 'cbSerializeData');
$this->registerCallback('after_store after_initialize', 'cbUnserializeData');
}
parent::__construct($id);
}
示例6: __construct
/**
* Constructor of the object. Provides a fallback if a url is passed
* instead of the usually expected numeric id in order to not break
* backward compatibility.
* But this constructor will fail miserably if a url is passed that
* is not in the database. This was chosen by design to encourage the
* correct use of an id.
*
* @param mixed $id Numeric id, existing url or null
*/
public function __construct($id = null)
{
// Try to find matching id when an url is passed instead of an id.
// This is to ensure that no legacy code will immediately break.
if ($id !== null && !ctype_digit($id)) {
$temp = self::findOneByUrl($id);
if ($temp) {
$id = $temp->id;
}
}
parent::__construct($id);
}
示例7: __construct
public function __construct($id = null)
{
$this->db_table = 'doc_filetype';
$this->has_many['forbiddenTypes'] = array(
'class_name' => 'DocFileTypeForbidden',
'on_delete' => 'delete',
'on_store' => 'store',
);
parent::__construct($id);
}
示例8: __construct
public function __construct($id = null)
{
parent::__construct($id);
$this->registerCallback('after_store before_delete', function ($notification) {
$query = "SELECT user_id\n FROM personal_notifications_user\n WHERE personal_notification_id = :id";
$statement = DBManager::get()->prepare($query);
$statement->bindValue(':id', $notification->id);
$statement->execute();
$user_ids = $statement->fetchAll(PDO::FETCH_COLUMN);
foreach ($user_ids as $user_id) {
PersonalNotifications::expireCache($user_id);
}
});
}
示例9: __construct
/**
* Defines the associated database table, relation to the schedule
* and appropriate callbacks to encode/decode a possible exception.
*
* @param mixed $id Id of the log entry in question or null for a new entry
*/
public function __construct($id = null)
{
$this->registerCallback('before_store after_store after_initialize', 'cbSerializeException');
parent::__construct($id);
}
示例10:
function __construct($id = null)
{
$this->registerCallback('after_store', 'afterStoreCallback');
parent::__construct($id);
}
示例11: __construct
public function __construct($id = null)
{
$this->db_table = 'doc_usergroup_config';
parent::__construct($id);
}
示例12:
function __construct($id = null)
{
parent::__construct($id);
$this->registerCallback('before_create', 'cbDefaultValues');
}
示例13: array
function __construct($id = array())
{
$this->db_table = 'help_tour_audiences';
parent::__construct($id);
}
示例14: __construct
/**
* constructor
* @param string/null $id : id of blubber-stream
*/
public function __construct($id = null)
{
$this->db_table = "blubber_streams";
$this->registerCallback('before_store', 'serializeData');
$this->registerCallback('after_store after_initialize', 'unserializeData');
$this->user_id = $GLOBALS['user']->id;
parent::__construct($id);
}
示例15: __construct
/**
* Overrides the contructor of SimpleORMap and is used in the exact same way.
* Adds a virtual field to the posting giving the time of the newest comment
* to the thread (or the thread.mkdate if no comment exists).
* @param null|string $id
*/
public function __construct($id = null)
{
$this->additional_fields['discussion_time']['get'] = function ($posting) {
if ($posting['topic_id'] === $posting['root_id']) {
$db = DBManager::get();
return $db->query("SELECT GREATEST(MAX(blubber.mkdate), IFNULL(MAX(blubber_reshares.chdate), 0)) " . "FROM blubber " . "LEFT JOIN blubber_reshares ON (blubber_reshares.topic_id = blubber.root_id) " . "WHERE root_id = " . $db->quote($posting->getId()) . " " . "GROUP BY blubber.root_id DESC " . "LIMIT 1 " . "")->fetch(PDO::FETCH_COLUMN, 0);
} else {
return $posting['mkdate'];
}
};
$this->db_table = "blubber";
$this->registerCallback('after_store', 'synchronizeHashtags');
parent::__construct($id);
}