public static function count( $def, $conds = null, $field = null ) { if ( !isset( $field ) ) { $field = '*'; } $customFields = array( array( 'operation' => 'COUNT( ' . $field . ' )', 'name' => 'row_count' ) ); $rows = MMPersistentObject::fetchObjectList( $def, array(), $conds, array(), null, false, false, $customFields ); return $rows[0]['row_count']; }
/** * @param int $applicationId * @return array[] */ public static function fetchAllowedUsersByApplication($applicationId) { $appLocalized = CacheApplicationTool::buildLocalizedApplicationByApplication($applicationId); $conditions = array( 'application_localized_id' => $appLocalized->id, ); $result = parent::fetchObjectList(self::definition(), null, $conditions, null, null, false ); $usersList = array(); foreach( $result as $row ) { if ( !empty($row) ) { $usersList[] = $row['user_uuid']; } } return $usersList; }
/** * @param array $conditions * @return ApplicationObject[] */ public static function fetchApplicationList ( $conditions = array() ) { if( is_null(self::$_applicationList ) ) { $appIds = parent::fetchObjectList(ApplicationObject::definition(), null, $conditions, null, null, false ); $apps = array(); foreach( $appIds as $appId ) { $appLocalized = CacheApplicationTool::buildLocalizedApplicationByApplication($appId['id']); if ( $appLocalized instanceof ApplicationLocalized && $appLocalized->applicationObject instanceof ApplicationObject ) $apps[] = $appLocalized->applicationObject; } self::$_applicationList = $apps; } return self::$_applicationList; }
/** * @return array */ public static function fetchPendingList() { return MMPersistentObject::fetchObjectList( self::definition(), null, null, array('created_at' => 'asc'), null, true, false, null, null, ' WHERE updated_at IS NULL' ); }
/** * @param string $applicationidentifier * @param string $speciality * @param int $page * @return Seo[] */ static function fetchKeywords($applicationidentifier, $speciality, $page = 1, $limit = 100) { if($speciality == "speciality") $speciality = ""; else if (is_array($speciality)) { $speciality = array($speciality); } $conds = array( "cluster_identifier" => ClusterTool::clusterIdentifier(), "application_identifier" => $applicationidentifier, "nb_results" => array(">=", 1) ); if ($speciality != null) { $conds["speciality"] = $speciality; } $max = $limit; $offset = (int) ($page * $max) - $max; $limit = array('limit'=>$max,'offset'=>$offset); return parent::fetchObjectList(self::definition(), array("keyword", "keyword_url", "speciality_url", "nb_results"), $conds, array("keyword" => "ASC"), $limit, false); }