/** * Browse the customergroup and parse their children * * @param SimpleXMLElement $xml * The xml parsed by parseFile * */ protected function parseCustomerGroups(SimpleXMLElement $xml) { //If there are no customergroups node continue to parse the xml $customerGroups = $xml->xpath('//config:customergroups/config:customergroup'); if (empty($customerGroups)) { return; } /** @var SimpleXMLElement $customerGroup */ foreach ($customerGroups as $customerGroup) { $customerGroupName = $customerGroup->getAttributeAsPhp('group'); $customerGroupModel = CustomerGroupQuery::create()->findOneByCode($customerGroupName); /** @var SimpleXMLElement $customerGroupChild */ foreach ($customerGroup->children() as $customerGroupChild) { switch ($customerGroupChild->getName()) { case 'extends-customergroupacl': $this->parseExtendCustomerGroupAcl($customerGroupChild, $customerGroupModel, $xml); break; case 'customergroupacl': $this->parseCustomerGroupAcl($customerGroupChild, $customerGroupModel); break; default: break; } } } }
/** * Get the associated ChildCustomerGroup object * * @param ConnectionInterface $con Optional Connection object. * @return ChildCustomerGroup The associated ChildCustomerGroup object. * @throws PropelException */ public function getCustomerGroup(ConnectionInterface $con = null) { if ($this->aCustomerGroup === null && $this->customer_group_id !== null) { $this->aCustomerGroup = CustomerGroupQuery::create()->findPk($this->customer_group_id, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aCustomerGroup->addCustomerGroupAcls($this); */ } return $this->aCustomerGroup; }