public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); if (!$this->_branches_table) { $this->_branches_table = ($meta->table() ?: Inflector::plural($meta->model())) . '_branches'; } $meta->associations(array('parent' => Jam::association('closuretable_parent', array('foreign_model' => $this->_model, 'branches_table' => $this->_branches_table, 'ansestor_key' => $this->_ansestor_key, 'descendant_key' => $this->_descendant_key, 'depth_key' => $this->_depth_key, 'inverse_of' => 'children')), 'children' => Jam::association('closuretable_children', array('foreign_model' => $this->_model, 'branches_table' => $this->_branches_table, 'ansestor_key' => $this->_ansestor_key, 'descendant_key' => $this->_descendant_key, 'depth_key' => $this->_depth_key, 'inverse_of' => 'parent', 'children_dependent' => $this->_children_dependent)))); $meta->events()->bind('model.after_save', array($this, 'model_before_after_save'), Jam_Event::ATTRIBUTE_PRIORITY + 1); }
public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); if ($this->_save_size) { $meta->field($name . '_width', Jam::field('integer'))->field($name . '_height', Jam::field('integer')); } if ($this->_dynamic_server) { $this->_dynamic_server = $this->_dynamic_server === TRUE ? $name . '_server' : $this->_dynamic_server; $meta->field($this->_dynamic_server, Jam::field('string', array('default' => $this->_server))); } $meta->field($name, Jam::field('upload', array('path' => $this->_path, 'thumbnails' => $this->_thumbnails, 'transformations' => $this->_transformations, 'server' => $this->_server, 'dynamic_server' => $this->_dynamic_server, 'save_size' => $this->_save_size, 'delete_file' => $this->_delete_file))); }
/** * Initializes the behavior * * It sets the fields used in generating the slug * * @param Jam_Event $event the jam event for the behavior * @param Jam_Model $model The Jam_Model object on which the behavior is applies * @param string $name * @return void */ public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->field('slug', Jam::field('slug')); if ($this->_unique) { $meta->validator('slug', array('unique' => $this->_unique)); } if (!$this->_slug) { $this->_slug = $this->_uses_primary_key ? 'Jam_Behavior_Sluggable::_uses_primary_key_pattern' : 'Jam_Behavior_Sluggable::_no_primary_key_pattern'; } if (empty($this->_pattern)) { $this->_pattern = $this->_uses_primary_key ? Jam_Behavior_Sluggable::ID_SLUG : Jam_Behavior_Sluggable::SLUG; } }
public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $this->_associations = (array) $this->_associations; $this->_fields = (array) $this->_fields; if (!$this->_parent) { $meta->field('is_frozen', Jam::field('boolean')); $meta->field('is_just_frozen', Jam::field('boolean', array('in_db' => FALSE))); } if ($this->_skippable) { $this->_skippable = is_string($this->_skippable) ? $this->_skippable : static::DEFAULT_SKIPPABLE_FIELD; $meta->field($this->_skippable, Jam::field('boolean', $this->_skippable_field_options)); } }
public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->field($this->_field, Jam::field('boolean', array('default' => FALSE))); $meta->events()->bind('builder.before_select', array($this, 'builder_paranoid_filter'))->bind('builder.before_update', array($this, 'builder_paranoid_filter')); }
public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->field($this->_field, Jam::field('integer', array('default' => 0))); }
public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->unique_key(array($this, 'username_key'))->name_key('username')->fields(['username' => Jam::field('string')])->validator('username', array('length' => array('minimum' => 3, 'maximum' => 32), 'present' => TRUE, 'format' => array('regex' => '/^[a-zA-Z0-9\\_\\-]+$/'))); }
public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->events()->bind('model.before_purchase', array($this, 'before_purchase'))->bind('model.after_purchase', array($this, 'after_purchase'))->bind('model.before_complete_purchase', array($this, 'before_complete_purchase'))->bind('model.after_complete_purchase', array($this, 'after_complete_purchase'))->bind('model.pay', array($this, 'pay'))->bind('model.before_refund', array($this, 'before_refund'))->bind('model.after_refund', array($this, 'after_refund'))->bind('model.before_full_refund', array($this, 'before_full_refund'))->bind('model.after_full_refund', array($this, 'after_full_refund')); }
public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->association($this->_terms_association_name, Jam::association('taxonomy_terms', $this->_terms_association_options))->association($this->_terms_items_association_name, Jam::association('hasmany', $this->_terms_items_association_options)); }
public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->events()->bind('model.add_item', array($this, 'add_item')); }
/** * @codeCoverageIgnore */ public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->events()->bind('model.after_refund', 'Jam_Behavior_Payment_Refundable::add_purchase_item_refund')->bind('model.after_full_refund', 'Jam_Behavior_Payment_Refundable::add_multiple_purchase_item_refunds'); }
public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->associations(array('parent' => Jam::association('belongsto', array('foreign_model' => $this->_model, 'foreign_key' => $this->_field, 'inverse_of' => 'children')), 'children' => Jam::association('hasmany', array('foreign_model' => $this->_model, 'foreign_key' => $this->_field, 'inverse_of' => 'parent', 'dependent' => $this->_children_dependent)))); }
/** * @codeCoverageIgnore */ public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->associations(array('shippings' => Jam::association('hasmany', array('inverse_of' => 'brand')), 'shipping_methods' => Jam::association('hasmany', array('inverse_of' => 'brand')))); }
public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->events()->bind('model.create_session', array($this, 'set_geoip_defaults'))->bind('model.create_session', array($this, 'set_new_token')); }
public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->field($this->_field, Jam::field('string', $this->_field_options)); }
public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->events()->bind('model.before_save', array($this, 'record_depth'))->bind('model.after_save', array($this, 'rollback_depth')); }
/** * @codeCoverageIgnore */ public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->fields(array('promo_code_text' => Jam::field('string', array('in_db' => FALSE))))->associations(array('promo_code' => Jam::association('belongsto', array('inverse_of' => 'purchases'))))->validator('promo_code_text', array('purchase_promocode' => TRUE)); }
/** * @codeCoverageIgnore */ public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->associations(array('shipping_item' => Jam::association('hasone', array('inverse_of' => 'purchase_item', 'foreign_key' => 'purchase_item_id', 'dependent' => Jam_Association::DELETE)))); }
/** * @codeCoverageIgnore */ public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->association('shipping', Jam::association('hasone', array('foreign_model' => 'brand_purchase_shipping', 'inverse_of' => 'brand_purchase', 'dependent' => Jam_Association::DELETE)))->events()->bind('model.update_items', array($this, 'add_brand_purchase_shipping'))->bind('model.update_items', array($this, 'update_shipping_items'))->bind('model.filter_items', array($this, 'filter_shipping_items')); }
/** * @codeCoverageIgnore */ public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->events()->bind('model.filter_items', array($this, 'filter_promotion_items'))->bind('model.update_items', array($this, 'update_promotion_items')); }
/** * @codeCoverageIgnore */ public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->associations(array('shipping_address' => Jam::association('belongsto', array('foreign_model' => 'address', 'dependent' => Jam_Association::DELETE))))->fields(array('shipping_same_as_billing' => Jam::field('boolean', array('default' => TRUE)), 'shipping_required' => Jam::field('boolean', array('in_db' => FALSE))))->events()->bind('model.add_item', array($this, 'add_item')); }
public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->associations(['parent' => Jam::association('materializedpath_belongsto', array('foreign_model' => $meta->model(), 'inverse_of' => 'children')), 'children' => Jam::association('materializedpath_hasmany', ['foreign_key' => 'parent_id', 'foreign_model' => $meta->model(), 'inverse_of' => 'parent'])])->fields(['path' => Jam::field('string')]); }
public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->events()->bind('model.create_session', array($this, 'create_session'))->bind('model.build_purchase', array($this, 'build_purchase')); }
public function initialize(Jam_Meta $meta, $name) { parent::initialize($meta, $name); $meta->association('visitor', Jam::association('hasone', array('inverse_of' => 'user'))); }