Example #1
0
 /**
  * Construct. Set all depends.
  *
  * Required parameteres for options:
  * - resource
  *
  * @param array $options
  * @throws Exception If passed parameter 'resource' is wrong
  */
 public function __construct($options)
 {
     if (!isset($options['resource']) || !$options['resource'] instanceof Mage_Api2_Model_Resource) {
         throw new Exception("Passed parameter 'resource' is wrong.");
     }
     $this->_resource = $options['resource'];
     $validationConfig = $this->_resource->getConfig()->getValidationConfig($this->_resource->getResourceType(), self::CONFIG_NODE_KEY);
     if (!is_array($validationConfig)) {
         $validationConfig = array();
     }
     $this->_buildValidatorsChain($validationConfig);
 }
Example #2
0
 /**
  * Retrieve a list of attributes to be included in output based on available and requested attributes
  *
  * @return array
  */
 public function getAttributesToInclude()
 {
     if (null === $this->_attributesToInclude) {
         $allowedAttrs = $this->getAllowedAttributes(Mage_Api2_Model_Resource::OPERATION_ATTRIBUTE_READ);
         $requestedAttrs = $this->_resource->getRequest()->getRequestedAttributes();
         if ($requestedAttrs) {
             foreach ($allowedAttrs as $allowedAttr) {
                 if (in_array($allowedAttr, $requestedAttrs)) {
                     $this->_attributesToInclude[] = $allowedAttr;
                 }
             }
         } else {
             $this->_attributesToInclude = $allowedAttrs;
         }
     }
     return $this->_attributesToInclude;
 }
Example #3
0
 /**
  * @inheritdoc
  */
 public function getFilter()
 {
     $this->_filter = null;
     return parent::getFilter();
 }