Пример #1
0
 /**
  * Constructor.
  *
  * @param 	object 	An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     $this->_root = $config->root;
     $this->_property = $config->property;
     $config->object = $config->service_container->get($config->repository->getEntityset(), $config->toArray());
     parent::__construct($config);
 }
Пример #2
0
 /**
  * Constructor.
  *
  * @param KConfig $config An optional KConfig object with configuration options.
  *
  * @return void
  */
 public function __construct(KConfig $config)
 {
     if (!$config->actor) {
         throw new KException('Actor object is missing');
     }
     $this->_actor = $config->actor;
     parent::__construct($config);
     $query = $this->getService($config->repository)->getQuery()->bind('actorid', $this->_actor->id)->bind('components_set_to_never', $this->getService('repos://site/components.assignment')->getQuery()->columns('id')->where('@col(actortype) = :actortype AND @col(access) = :never'))->bind('actortype', (string) $this->_actor->getEntityDescription()->getInheritanceColumnValue()->getIdentifier())->bind('never', ComComponentsDomainBehaviorAssignable::ACCESS_NEVER)->bind('always', ComComponentsDomainBehaviorAssignable::ACCESS_ALWAYS)->bind('optional', ComComponentsDomainBehaviorAssignable::ACCESS_OPTIONAL);
     $query->link('repos://site/components.assignment', '@col(assignment.component) = @col(component)', array('type' => 'weak'))->enabled(true)->where('@col(id) NOT IN (:components_set_to_never)');
     if ($config->can_enable) {
         $query->where('@col(assignment.actortype) = :actortype AND @col(access) = :optional');
     } else {
         $query->where('((@col(assignment.actortype) = :actortype AND @col(access) = :always) OR @col(assignment.actor.id)  = :actorid OR @col(option) = "com_stories")');
     }
     $config['query'] = $query;
     $this->_object = $this->getService('anahita:domain.entityset', KConfig::unbox($config));
 }