File tree Expand file tree Collapse file tree
ModelSerializers/Companies
Models/Foundation/Main/Companies Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ final class CompanySerializer extends BaseCompanySerializer
2626 'Featured ' => 'featured:json_boolean ' ,
2727 'ContactEmail ' => 'contact_email:json_string ' ,
2828 'AdminEmail ' => 'admin_email:json_string ' ,
29+ 'COAPartner ' => 'is_coa_partner:json_boolean ' ,
2930 ];
3031
3132 protected static $ allowed_relations = [
Original file line number Diff line number Diff line change @@ -645,4 +645,22 @@ public function getUrlSegment(): ?string{
645645 public function setUrlSegment (string $ url_segment ): void {
646646 $ this ->url_segment = $ url_segment ;
647647 }
648+
649+ public function isCOAPartner ():bool {
650+ try {
651+ $ sql = <<<SQL
652+ SELECT COUNT(ID) FROM `COALandingPage_TrainingPartners` where CompanyID = :company_id;
653+ SQL ;
654+
655+ $ stmt = $ this ->prepareRawSQL ($ sql );
656+ $ stmt ->execute (['company_id ' => $ this ->id ]);
657+ $ res = $ stmt ->fetchAll (\PDO ::FETCH_COLUMN );
658+ $ res = count ($ res ) > 0 ? $ res [0 ] : 0 ;
659+ $ count = !is_null ($ res ) ? $ res : 0 ;
660+ return $ count > 0 ;
661+ }
662+ catch (\Exception $ ex ){
663+ return false ;
664+ }
665+ }
648666}
You can’t perform that action at this time.
0 commit comments