| |
| scriptlog:lib:dao:languagedao [2026/09/26 09:09] – admin admin | scriptlog:lib:dao:languagedao [2026/09/26 09:16] (current) – admin admin |
|---|
| ======= Docblock Metadata ======= | ======= Docblock Metadata ======= |
| |
| ^ Tag ^ Value ^ | ^ Tag ^ Value ^ |
| | ''@category'' | DAO Class | | | ''@category'' | DAO Class | |
| | ''@author'' | M.Noermoehammad | | | ''@author'' | M.Noermoehammad | |
| | ''@license'' | MIT | | | ''@license'' | MIT | |
| | ''@version'' | 1.0 | | | ''@version'' | 1.0 | |
| | ''@since'' | Since Release 1.0 | | | ''@since'' | Since Release 1.0 | |
| |
| ======= Inheritance ======= | ======= Inheritance ======= |
| |
| ^ Relation ^ Type ^ Meaning ^ | ^ Relation ^ Type ^ Meaning ^ |
| | extends | [[scriptlog:lib:core:dao|''Dao'']] | parent class/interface | | | extends | [[scriptlog:lib:core:dao|''Dao'']] | parent class/interface | |
| |
| ======= Constants (0) ======= | ======= Constants (0) ======= |
| ======= Methods (11) ======= | ======= Methods (11) ======= |
| |
| ^ Visibility ^ Method ^ Summary ^ Line ^ | ^ Visibility ^ Method ^ Summary ^ Line ^ |
| | public | ''createLanguage()'' | Create a new language record. | 44 | | | public | ''createLanguage()'' | Create a new language record. | 44 | |
| | public | ''findById()'' | Find a language record by its primary key. | 66 | | | public | ''findById()'' | Find a language record by its primary key. | 66 | |
| | public | ''findLanguageByCode()'' | Find a language record by its unique language code. | 79 | | | public | ''findLanguageByCode()'' | Find a language record by its unique language code. | 79 | |
| | public | ''findActiveLanguages()'' | Find all active language records. | 94 | | | public | ''findActiveLanguages()'' | Find all active language records. | 94 | |
| | public | ''findDefaultLanguage()'' | Find the default language record. | 108 | | | public | ''findDefaultLanguage()'' | Find the default language record. | 108 | |
| | public | ''updateLanguage()'' | Update an existing language record. | 125 | | | public | ''updateLanguage()'' | Update an existing language record. | 125 | |
| | public | ''setDefaultLanguage()'' | Mark a language as the site's default. | 140 | | | public | ''setDefaultLanguage()'' | Mark a language as the site's default. | 140 | |
| | public | ''deleteLanguage()'' | Delete a language record by its primary key. | 152 | | | public | ''deleteLanguage()'' | Delete a language record by its primary key. | 152 | |
| | public | ''countLanguages()'' | Count all language records. | 162 | | | public | ''countLanguages()'' | Count all language records. | 162 | |
| | public | ''codeExists()'' | Check whether a language code already exists. | 177 | | | public | ''codeExists()'' | Check whether a language code already exists. | 177 | |
| | public | ''findAllLanguages()'' | Find all language records, active or not. | 192 | | | public | ''findAllLanguages()'' | Find all language records, active or not. | 192 | |
| |
| |
| `lang_sort` (0), `lang_is_default` (0), `lang_is_active` (1). | `lang_sort` (0), `lang_is_default` (0), `lang_is_active` (1). |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$data'' | ''array'' | //required// | //none// | | | ''$data'' | ''array'' | //required// | //none// | |
| |
| **Returns:** ''int'' — int The ID of the newly created language record | **Returns:** ''int'' — int The ID of the newly created language record |
| Find a language record by its primary key. | Find a language record by its primary key. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$id'' | ''int'' | //required// | The language ID | | | ''$id'' | ''int'' | //required// | The language ID | |
| |
| **Returns:** ''?array'' — array<string, mixed>|null The language row, or null when not found | **Returns:** ''?array'' — array<string, mixed>|null The language row, or null when not found |
| Find a language record by its unique language code. | Find a language record by its unique language code. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$code'' | ''string'' | //required// | The language code, e.g. 'en' or 'ar' | | | ''$code'' | ''string'' | //required// | The language code, e.g. 'en' or 'ar' | |
| |
| **Returns:** ''?array'' — array<string, mixed>|null The language row, or null when not found | **Returns:** ''?array'' — array<string, mixed>|null The language row, or null when not found |
| ignored by the database wrapper. | ignored by the database wrapper. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$id'' | ''int'' | //required// | The language ID to update | | | ''$id'' | ''int'' | //required// | The language ID to update | |
| | ''$data'' | ''array'' | //required// | //none// | | | ''$data'' | ''array'' | //required// | //none// | |
| |
| **Returns:** ''void'' — void | **Returns:** ''void'' — void |
| language ID, guaranteeing exactly one default at a time. | language ID, guaranteeing exactly one default at a time. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$id'' | ''int'' | //required// | The language ID to promote to default | | | ''$id'' | ''int'' | //required// | The language ID to promote to default | |
| |
| **Returns:** ''void'' — void | **Returns:** ''void'' — void |
| Delete a language record by its primary key. | Delete a language record by its primary key. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$id'' | ''int'' | //required// | The language ID to delete | | | ''$id'' | ''int'' | //required// | The language ID to delete | |
| |
| **Returns:** ''void'' — void | **Returns:** ''void'' — void |
| Useful for uniqueness validation before insert or update operations. | Useful for uniqueness validation before insert or update operations. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$code'' | ''string'' | //required// | The language code to check, e.g. 'en' | | | ''$code'' | ''string'' | //required// | The language code to check, e.g. 'en' | |
| |
| **Returns:** ''bool'' — bool True when the code already exists, false otherwise | **Returns:** ''bool'' — bool True when the code already exists, false otherwise |
| ======= Imports ======= | ======= Imports ======= |
| |
| ^ Alias ^ Fully-qualified name ^ | ^ Alias ^ Fully-qualified name ^ |
| | ''Dao'' | [[scriptlog:lib:core:dao|''Scriptlog\Core\Dao'']] | | | ''Dao'' | [[scriptlog:lib:core:dao|''Scriptlog\Core\Dao'']] | |
| |
| |