This project is read-only.
1
Vote

Pluralized Resource Sets Not Functioning

description

If you have a table with a non pluralized name, when the entity collection is pluralized it causes that collection to be inaccessible. It looks like the singularizing code is in the wrong spot in the provider. It looks like this in getResourceSet and getResourceFromResourceSet:
        public function getResourceSet(ResourceSet $resourceSet, $filterOption = null, 
            $select=null, $orderby=null, $top=null, $skip=null)
        {   
            $resourceSetName =  $resourceSet->getName();
            if( $resourceSetName !== 'Addresses'
                        
            and $resourceSetName !== 'Affiliate'
                        
            and $resourceSetName !== 'Company'
                         
            and $resourceSetName !== 'Segments'
                        )               
            {
                die('(MarketerQueryProvider) Unknown resource set ' . $resourceSetName);
            }
             
            if($resourceSetName === 'Affiliates')
            {
                $resourceSetName = 'Affiliate';
            }   
                     
            if($resourceSetName === 'Companies')
            {
                $resourceSetName = 'Company';
            }   
                                
            $query = "SELECT * FROM $resourceSetName";
I think it should be:
        public function getResourceSet(ResourceSet $resourceSet, $filterOption = null, 
            $select=null, $orderby=null, $top=null, $skip=null)
        {   
            $resourceSetName =  $resourceSet->getName();
                        if($resourceSetName === 'Affiliates')
            {
                $resourceSetName = 'Affiliate';
            }   
                     
            if($resourceSetName === 'Companies')
            {
                $resourceSetName = 'Company';
            }   
            
            if( $resourceSetName !== 'Addresses'
                        
            and $resourceSetName !== 'Affiliate'
                        
            and $resourceSetName !== 'Company'
                         
            and $resourceSetName !== 'Segments'
                        )               
            {
                die('(MarketerQueryProvider) Unknown resource set ' . $resourceSetName);
            }
             

                                
            $query = "SELECT * FROM $resourceSetName";

comments

rgardelein wrote Apr 3, 2014 at 4:35 PM

I am experiencing the exact same issue. Is there any update on this?

Managed to get around the issue by pluralizing the resourcesetnames in the check, but there must be a better solution for this.

All is working fine in case the Mysql tables have pluralized names. If not, this test is failing.