本文整理汇总了PHP中ObjectModel::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectModel::__construct方法的具体用法?PHP ObjectModel::__construct怎么用?PHP ObjectModel::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectModel
的用法示例。
在下文中一共展示了ObjectModel::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($id = NULL, $id_lang = NULL)
{
parent::__construct($id, $id_lang);
if ($this->name == '0') {
$this->name = Configuration::get('PS_SHOP_NAME');
}
}
示例2: array
function __construct($id = null)
{
if (version_compare(_PS_VERSION_, '1.5.0.2', '<')) {
$definition = $this->getDefinitionProperty();
// child class name
$this->tables = array($definition['table']);
$this->table = $definition['table'];
$this->identifier = $definition['primary'];
}
if (version_compare(_PS_VERSION_, '1.5', '<')) {
$definition = $this->getDefinitionProperty();
// child class name
$this->tables = array($definition['table']);
$this->table = $definition['table'];
$this->identifier = $definition['primary'];
foreach ($definition['fields'] as $field_name => $field) {
if (!in_array($field_name, array('id_shop', 'date_upd', 'date_add'))) {
$validateRule = isset($field['validate']) ? $field['validate'] : 'isAnything';
$this->fieldsValidate[$field_name] = $validateRule;
if (isset($field['required'])) {
array_push($this->fieldsRequired, $field_name);
}
if (isset($field['size'])) {
$this->fieldsSize[$field_name] = $field['size'];
}
}
}
}
return parent::__construct($id);
}
示例3: __construct
public function __construct(SplFileInfo $fileinfo = null)
{
parent::__construct();
if ($fileinfo) {
$this->file_hash = md5($fileinfo->getRealPath());
$fileSize = $fileinfo->getSize();
// Looking for existing path
$result = Db::getInstance()->getRow('
SELECT *
FROM `' . _DB_PREFIX_ . bqSQL(self::$definition['table']) . '`
WHERE `file_hash` = \'' . pSQL($this->file_hash) . '\'');
if (!$result) {
$this->file_size = $fileSize;
$this->file_info = $fileinfo;
} else {
$this->id = $result['id'];
foreach ($result as $key => $value) {
if (array_key_exists($key, $this)) {
$this->{$key} = $value;
}
}
// Check file size
if ($this->file_size != $fileSize) {
$this->file_size = $fileSize;
$this->file_info = $fileinfo;
}
}
}
return $this;
}
示例4: __construct
public function __construct($id = NULL, $id_lang = NULL)
{
parent::__construct($id, $id_lang);
/* Get the manufacturer's id_address */
$this->id_address = $this->getManufacturerAddress();
$this->link_rewrite = $this->getLink();
}
示例5: __construct
public function __construct($id = null, $id_lang = null, $id_shop = null)
{
parent::__construct($id, $id_lang, $id_shop);
if ($this->id && !isset(Group::$group_price_display_method[$this->id])) {
self::$group_price_display_method[$this->id] = $this->price_display_method;
}
}
示例6: __construct
public function __construct($id = null)
{
if (version_compare(_PS_VERSION_, '1.5', '<')) {
$caller_class_name = $this->getCallerClassName();
// child class name
if (property_exists($caller_class_name, 'definition')) {
$class_variables = get_class_vars($caller_class_name);
$this->table = $class_variables['definition']['table'];
$this->identifier = $class_variables['definition']['primary'];
foreach ($class_variables['definition']['fields'] as $field_name => $field) {
if (!in_array($field_name, array('id_shop', 'date_upd', 'date_add'))) {
$validate_rule = isset($field['validate']) ? $field['validate'] : 'isAnything';
$this->fieldsValidate[$field_name] = $validate_rule;
if (isset($field['required'])) {
array_push($this->fieldsRequired, $field_name);
}
if (isset($field['size'])) {
$this->fieldsSize[$field_name] = $field['size'];
}
}
}
}
}
return parent::__construct($id);
}
示例7: __construct
public function __construct($id = NULL, $identifier = 'id_shopgate_order')
{
$this->identifier = $identifier;
parent::__construct($id);
$this->id = $this->id_shopgate_order;
$this->identifier = 'id_shopgate_order';
}
示例8: __construct
public function __construct($id = null, $alias = null, $search = null, $id_lang = null)
{
$this->def = Alias::getDefinition($this);
$this->setDefinitionRetrocompatibility();
if ($id) {
parent::__construct($id);
} elseif ($alias && Validate::isValidSearch($alias)) {
if (!Alias::isFeatureActive()) {
$this->alias = trim($alias);
$this->search = trim($search);
} else {
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT a.id_alias, a.search, a.alias
FROM `' . _DB_PREFIX_ . 'alias` a
WHERE `alias` LIKE \'' . pSQL($alias) . '\' AND `active` = 1');
if ($row) {
$this->id = (int) $row['id_alias'];
$this->search = $search ? trim($search) : $row['search'];
$this->alias = $row['alias'];
} else {
$this->alias = trim($alias);
$this->search = trim($search);
}
}
}
}
示例9: __construct
public function __construct($id_simpleblog_post = null, $id_lang = null, $id_shop = null)
{
parent::__construct($id_simpleblog_post, $id_lang, $id_shop);
$category = new SimpleBlogCategory($this->id_simpleblog_category, $id_lang);
$this->category = $category->name;
$this->category_rewrite = $category->link_rewrite;
$this->url = self::getLink($this->link_rewrite, $this->category_rewrite, $id_lang);
$this->category_url = SimpleBlogCategory::getLink($category->link_rewrite, $id_lang);
if ($category->id_parent > 0) {
$parent = new SimpleBlogCategory($category->id_parent, $id_lang);
$this->parent_category = $parent;
}
if (file_exists(_PS_MODULE_DIR_ . 'ph_simpleblog/covers/' . $this->id_simpleblog_post . '.' . $this->cover)) {
$this->banner = _MODULE_DIR_ . 'ph_simpleblog/covers/' . $this->id_simpleblog_post . '.' . $this->cover;
$this->banner_thumb = _MODULE_DIR_ . 'ph_simpleblog/covers/' . $this->id_simpleblog_post . '-thumb.' . $this->cover;
$this->banner_wide = _MODULE_DIR_ . 'ph_simpleblog/covers/' . $this->id_simpleblog_post . '-wide.' . $this->cover;
}
if (file_exists(_PS_MODULE_DIR_ . 'ph_simpleblog/featured/' . $this->id_simpleblog_post . '.' . $this->featured)) {
$this->featured_image = _MODULE_DIR_ . 'ph_simpleblog/featured/' . $this->id_simpleblog_post . '.' . $this->featured;
}
if ($this->id) {
$tags = SimpleBlogTag::getPostTags((int) $this->id);
$this->tags = $tags;
if (isset($tags) && isset($tags[$id_lang])) {
$this->tags_list = $tags[$id_lang];
}
$this->comments = SimpleBlogComment::getCommentsCount((int) $this->id);
$this->post_type = SimpleBlogPostType::getSlugById((int) $this->id_simpleblog_post_type);
if ($this->post_type == 'gallery') {
$this->gallery = SimpleBlogPostImage::getAllById((int) $this->id);
}
}
}
示例10: __construct
/**
* On shop instance, get its theme and URL data too
*
* @param int $id
* @param int $id_lang
* @param int $id_shop
*/
public function __construct($id = null, $id_lang = null, $id_shop = null)
{
parent::__construct($id, $id_lang, $id_shop);
if ($this->id) {
$this->setUrl();
}
}
示例11: __construct
public function __construct($id = NULL, $id_lang = NULL)
{
parent::__construct($id, $id_lang);
if ($this->id) {
$this->default_img = $this->getDefaultImage();
}
}
示例12: __construct
public function __construct($id = null, $id_lang = null, $id_shop = null)
{
parent::__construct($id, $id_lang, $id_shop);
if ($this->id) {
$this->associated_shops = $this->getAssociatedShops();
}
}
示例13: __construct
public function __construct($id_seo = NULL, $id_lang = NULL, $id_shop = NULL)
{
if (version_compare(_PS_VERSION_, '1.5.0.0', '>=')) {
parent::__construct($id_seo, $id_lang, $id_shop);
} else {
parent::__construct($id_seo, $id_lang);
}
}
示例14: __construct
public function __construct($id = null, $id_lang = null, $id_shop = null)
{
parent::__construct($id, $id_lang, $id_shop);
// prefix and suffix are convenient shortcut for displaying
// price sign before or after the price number
$this->prefix = $this->format % 2 != 0 ? $this->sign . ' ' : '';
$this->suffix = $this->format % 2 == 0 ? ' ' . $this->sign : '';
}
示例15: __construct
public function __construct($id_address = NULL, $id_lang = NULL)
{
parent::__construct($id_address);
// Check if all files needed are here, if not, disabled language
if ($this->iso_code != 'en' and !$this->checkFiles()) {
$this->active = false;
}
}