/** * Initializes the options for an entity after being created * * @param object An optional KConfig object with configuration options. * @return void */ protected function _afterEntityInstantiate(KConfig $config) { $data = $config->data; $data->append(array('subscribers' => array())); if ($data->object) { if (is($data->object, 'ComBaseDomainEntityComment')) { $data->comment = $data->object; $data->object = $data->comment->parent; $data->append(array('subscribers' => array($data->comment->author->id))); } elseif ($data->object->isModifiable() && !is($data->object, 'ComActorsDomainEntityActor')) { $data->append(array('subscribers' => array($data->object->author->id))); } elseif (is_person($data->object)) { $data->append(array('subscribers' => array($data->object->id))); } if ($data->object->isOwnable()) { $data->target = $data->object->owner; } } if ($data->target && $data->target->isNotifiable()) { $data->append(array('subscribers' => array($data->target->id))); } parent::_afterEntityInstantiate($config); if ($config->data->subscribers) { $this->setSubscribers($config->data->subscribers); } }
/** * Initializes the default configuration for the object. * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. */ protected function _initialize(KConfig $config) { $config->append(array('inheritance' => array('abstract' => $this->getIdentifier()->classname === __CLASS__), 'relationships' => array('author' => array('parent' => 'com:people.domain.entity.person', 'child_column' => 'created_by', 'required' => true)), 'attributes' => array('name' => array('read' => 'public'), 'enabled' => array('default' => 1)), 'behaviors' => array('votable', 'authorizer', 'privatable', 'ownable', 'dictionariable', 'subscribable', 'describable', 'com://site/hashtags.domain.behavior.hashtagable', 'com://site/people.domain.behavior.mentionable'))); $behaviors = $config->behaviors; $behaviors->append(array('modifiable' => array('modifiable_properties' => array('name', 'body')), 'commentable' => array('comment' => array('length' => 5000)))); parent::_initialize($config); }
/** * Initializes the default configuration for the object. * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. */ protected function _initialize(KConfig $config) { $config->append(array('inheritance' => array('ignore' => __CLASS__), 'behaviors' => array('privatable', 'com://site/locations.domain.behavior.geolocatable'))); parent::_initialize($config); }
/** * (non-PHPdoc). * * @see AnDomainEntityAbstract::__get() */ public function __get($name) { if ($name == 'components') { if (!isset($this->_components)) { $this->_components = $this->getService('com://site/actors.domain.entityset.component', array('actor' => $this)); } return $this->_components; } elseif ($name == 'uniqueAlias') { return $this->get('id'); } else { return parent::__get($name); } }
/** * Initializes the default configuration for the object. * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. */ protected function _initialize(KConfig $config) { $config->append(array('resources' => array('subscriptions_packages'), 'attributes' => array('name' => array('required' => true), 'body' => array('format' => 'html'), 'price' => array('type' => 'float', 'required' => true), 'duration' => array('type' => 'integer', 'required' => true), 'recurring' => array('type' => 'integer', 'default' => 0), 'billingPeriod' => array('column' => 'billing_period', 'required' => true)), 'relationships' => array('subscriptions' => array('parent_delete' => 'ignore')), 'behaviors' => array('authorizer', 'orderable', 'describable', 'enableable', 'dictionariable', 'modifiable'))); parent::_initialize($config); }
/** * Initializes the default configuration for the object. * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. */ protected function _initialize(KConfig $config) { $config->append(array('attributes' => array('actortype' => array('column' => 'name'), 'access'), 'relationships' => array('componentEntity' => array('type' => 'belongs_to', 'child_column' => 'component', 'parent_key' => 'component', 'parent' => 'com:components.domain.entity.assignment'), 'actor' => array('type' => 'belongs_to', 'child_column' => 'owner_id', 'type_column' => 'owner_type', 'polymorphic' => true)))); parent::_initialize($config); }
/** * Initializes the default configuration for the object * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. * * @return void */ protected function _initialize(KConfig $config) { $config->append(array('attributes' => array('name' => array('required' => AnDomain::VALUE_NOT_EMPTY, 'format' => 'string', 'read' => 'public', 'unique' => true)), 'behaviors' => to_hash(array('modifiable', 'describable')), 'relationships' => array('tagables' => array('through' => 'tag', 'child_key' => 'hashtag', 'target' => 'com:tags.domain.entity.node', 'target_child_key' => 'tagable')))); parent::_initialize($config); }
protected function _initialize(\KConfig $config) { $config->append(array('attributes' => array('name' => array('required' => AnDomain::VALUE_NOT_EMPTY), 'body' => array('required' => AnDomain::VALUE_NOT_EMPTY)), 'behaviors' => array('parentable' => array('parent' => 'thread', 'parent_delete' => 'ignore'), 'modifiable' => array('modifiable_properties' => array('name', 'body')), 'describable', 'votable', 'authorizer', 'enableable', 'com://site/hashtags.domain.behavior.hashtagable', 'com://site/people.domain.behavior.mentionable', 'privatable', 'com://site/forums.domain.behavior.newable'))); parent::_initialize($config); }
/** * Initializes the default configuration for the object * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. * * @return void */ protected function _initialize(KConfig $config) { $config->append(array('inheritance' => array('ignore' => __CLASS__), 'behaviors' => array('privatable'))); parent::_initialize($config); }
/** * Initializes the default configuration for the object * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. * * @return void */ protected function _initialize(KConfig $config) { $config->append(array('attributes' => array('name' => array('required' => true), 'body' => array('format' => 'string')), 'relationships' => array('subject' => array('required' => true, 'parent' => 'com:actors.domain.entity.actor', 'child_column' => 'story_subject_id'), 'target' => array('parent' => 'com:actors.domain.entity.actor', 'child_column' => 'story_target_id'), 'comment' => array('parent' => 'com:base.domain.entity.comment', 'child_column' => 'story_comment_id'), 'object' => array('polymorphic' => true, 'type_column' => 'story_object_type', 'child_column' => 'story_object_id', 'parent' => 'com:medium.domain.entity.medium')), 'behaviors' => array('aggregatable', 'authorizer', 'modifiable', 'ownable'))); parent::_initialize($config); }
/** * Initializes the default configuration for the object. * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. */ protected function _initialize(KConfig $config) { $config->append(array('inheritance' => array('abstract' => $this->getIdentifier()->package == 'base'), 'attributes' => array('body' => array('required' => AnDomain::VALUE_NOT_EMPTY, 'format' => 'string')), 'behaviors' => array('parentable' => array('parent' => 'com:base.domain.entity.node'), 'com://site/hashtags.domain.behavior.hashtagable', 'com://site/people.domain.behavior.mentionable', 'modifiable', 'authorizer', 'locatable', 'votable'))); parent::_initialize($config); }
protected function _initialize(KConfig $config) { $config->append(array('attributes' => array('name' => array('required' => AnDomain::VALUE_NOT_EMPTY)), 'relationships' => array('forums'), 'behaviors' => array('authorizer', 'describable', 'orderable', 'parentable' => array('parent' => 'forum'), 'privatable'))); parent::_initialize($config); }
protected function _initialize(KConfig $config) { $config->append(array('attributes' => array('name' => array('required' => AnDomain::VALUE_NOT_EMPTY), 'body'), 'behaviors' => array('authorizer', 'describable', 'dictionariable', 'enableable', 'com://site/forums.domain.behavior.hittable', 'com://site/forums.domain.behavior.newable', 'lockable', 'modifiable', 'parentable' => array('parent' => 'forum'), 'privatable', 'pinnable', 'com://site/forums.domain.behavior.repliable', 'subscribable'), 'relationships' => array('posts'))); parent::_initialize($config); }