@@ -76,8 +76,7 @@ There are two ActiveRecord methods for querying data from database:
-[[ActiveRecord::find()]]
-[[ActiveRecord::findBySql()]]
Both methods return an [[ActiveQuery]] instance, which extends [[Query]], and thus supports
the same set of flexible and powerful DB query methods. The following examples demonstrate some of the possibilities.
Both methods return an [[ActiveQuery]] instance, which extends [[Query]], and thus supports the same set of flexible and powerful DB query methods. The following examples demonstrate some of the possibilities.
```php
// to retrieve all *active* customers and order them by their ID:
...
...
@@ -119,8 +118,7 @@ Accessing Column Data
---------------------
ActiveRecord maps each column of the corresponding database table row to an attribute in the ActiveRecord
object. The attribute behaves like any regular object public property. The attribute's name will be the same as the corresponding column
name, and is case-sensitive.
object. The attribute behaves like any regular object public property. The attribute's name will be the same as the corresponding column name, and is case-sensitive.
To read the value of a column, you can use the following syntax:
...
...
@@ -151,9 +149,7 @@ ActiveRecord provides the following methods to insert, update and delete data in
Note that [[ActiveRecord::updateAll()|updateAll()]], [[ActiveRecord::updateAllCounters()|updateAllCounters()]]
and [[ActiveRecord::deleteAll()|deleteAll()]] are static methods that apply to the whole database
table. The other methods only apply to the row associated with the ActiveRecord object through which the method is being called.
Note that [[ActiveRecord::updateAll()|updateAll()]], [[ActiveRecord::updateAllCounters()|updateAllCounters()]] and [[ActiveRecord::deleteAll()|deleteAll()]] are static methods that apply to the whole database table. The other methods only apply to the row associated with the ActiveRecord object through which the method is being called.
```php
// to insert a new customer record
...
...
@@ -477,7 +473,7 @@ of the corresponding JOIN query. For example,
```php
// SELECT tbl_user.* FROM tbl_user LEFT JOIN tbl_item ON tbl_item.owner_id=tbl_user.id AND category_id=1
// SELECT * FROM tbl_item WHERE owner_id IN (...) AND category_id=1
$users=User::model()->joinWith('books')->all();
$users=User::find()->joinWith('books')->all();
```
Note that if you use eager loading via [[ActiveQuery::with()]] or lazy loading, the on-condition will be put
...
...
@@ -485,7 +481,7 @@ in the WHERE part of the corresponding SQL statement, because there is no JOIN q
```php
// SELECT * FROM tbl_user WHERE id=10
$user=User::model(10);
$user=User::find(10);
// SELECT * FROM tbl_item WHERE owner_id=10 AND category_id=1
$books=$user->books;
```
...
...
@@ -552,7 +548,7 @@ Custom scopes
When [[find()]] or [[findBySql()]] Active Record method is being called without parameters it returns an [[ActiveQuery]]
instance. This object holds all the parameters and conditions for a future query and also allows you to customize these
using a set of methods that are called scopes. By deafault there is a good set of such methods some of which we've
using a set of methods that are called scopes. By default there is a good set of such methods some of which we've
already used above: `where`, `orderBy`, `limit` etc.
In many cases it is convenient to wrap extra conditions into custom scope methods. In order to do so you need two things.
...
...
@@ -561,7 +557,7 @@ First is creating a custom query class for your model. For example, a `Comment`
'Only files with these extensions are allowed: {extensions}.'=>'Επιτρέπονται αρχεία μόνο με καταλήξεις: {extensions}.',
'Only files with these mimeTypes are allowed: {mimeTypes}.'=>'Επιτρέπονται αρχεία μόνο με MIME τύπο: {mimeTypes}.',
'Page not found.'=>'Η σελίδα δεν βρέθηκε.',
'Please fix the following errors:'=>'Παρακαλώ διορθώστε τα παρακάτω σφάλματα:',
'Please upload a file.'=>'Παρακαλώ μεταφορτώστε ένα αρχείο.',
'The file "{file}" is not an image.'=>'Το αρχείο «{file}» δεν είναι εικόνα.',
'The file "{file}" is too big. Its size cannot exceed {limit, number} {limit, plural, one{byte} other{bytes}}.'=>'Το αρχείο «{file}» είναι πολύ μεγάλο . Το μέγεθος του δεν μπορεί να είναι πάνω από {limit, number} {limit, plural, one{byte} other{bytes}}.',
'The image "{file}" is too large. The height cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.'=>'Το αρχείο «{file}» είναι πολύ μεγάλο. Το ύψος δεν μπορεί να είναι μεγαλύτερο από {limit, number} {limit, plural, one{pixel} few{pixels} many{pixels} other{pixels}}.',
'The image "{file}" is too large. The width cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.'=>'Το αρχείο «{file}» είναι πολύ μεγάλο. Το πλάτος δεν μπορεί να είναι μεγαλύτερο από {limit, number} {limit, plural, one{pixel} few{pixels} many{pixels} other{pixels}}.',
'The file "{file}" is too small. Its size cannot be smaller than {limit, number} {limit, plural, one{byte} other{bytes}}.'=>'Το αρχείο «{file}» είναι πολύ μικρό. Το μέγεθος του δεν μπορεί να είναι μικρότερο από {limit, number} {limit, plural, one{byte} few{bytes} many{bytes} other{bytes}}.',
'The image "{file}" is too small. The height cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.'=>'Το αρχείο «{file}» είναι πολύ μικρό. To ύψος δεν μπορεί να είναι μικρότερο από {limit, number} {limit, plural, one{pixel} few{pixels} many{pixels} other{pixels}}.',
'The image "{file}" is too small. The width cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.'=>'Το αρχείο «{file}» είναι πολύ μικρό. Το πλάτος του δεν μπορεί να είναι μικρότερο από {limit, number} {limit, plural, one{pixel} few{pixels} many{pixels} other{pixels}}.',
'The format of {attribute} is invalid.'=>'Ο τύπος του «{attribute}» δεν είναι έγκυρος.',
'The verification code is incorrect.'=>'Ο κωδικός επαλήθευσης είναι εσφαλμένος.',
'Update'=>'Ενημέρωση',
'User Error'=>'Σφάλμα χρήστη',
'User Warning'=>'Προειδοποίηση χρήστη',
'Warning'=>'Προειδοποίηση',
'Yes'=>'Ναι',
'You are not allowed to perform this action.'=>'Δεν επιτρέπεται να εκτελέσετε αυτή τη δράση.',
'You can upload at most {limit, number} {limit, plural, one{file} other{files}}.'=>'Μπορείτε να μεταφορτώσετε το πολύ {limit, number} {limit, plural, one{αρχείο} few{αρχεία} many{αρχεία} other{αρχεία}}.',
'{attribute} "{value}" has already been taken.'=>'{attribute} «{value}» έχει ήδη καταχωρηθεί.',
'{attribute} cannot be blank.'=>'Το «{attribute}» δεν μπορεί να είναι κενό.',
'{attribute} is invalid.'=>'Το «{attribute}» δεν είναι έγκυρο.',
'{attribute} is not a valid URL.'=>'Το «{attribute}» δεν είναι έγκυρο URL.',
'{attribute} is not a valid email address.'=>'Η διεύθυνση email «{attribute}» δεν είναι έγκυρη .',
'{attribute} must be "{requiredValue}".'=>'Το «{attribute}» πρέπει να είναι «{requiredValue}».',
'{attribute} must be a number.'=>'Το «{attribute}» πρέπει να είναι αριθμός.',
'{attribute} must be a string.'=>'Το «{attribute}» πρέπει να είναι συμβολοσειρά.',
'{attribute} must be an integer.'=>'Το «{attribute}» πρέπει να είναι ακέραιος.',
'{attribute} must be either "{true}" or "{false}".'=>'Το «{attribute}» πρέπει να είναι «{true}» ή «{false}».',
'{attribute} must be greater than "{compareValue}".'=>'Το «{attribute}» πρέπει να είναι μεγαλύτερο από «{compareValue}».',
'{attribute} must be greater than or equal to "{compareValue}".'=>'Το «{attribute}» πρέπει να είναι μεγαλύτερο ή ίσο με «{compareValue}».',
'{attribute} must be less than "{compareValue}".'=>'Το «{attribute}» πρέπει να είναι μικρότερο από «{compareValue}».',
'{attribute} must be less than or equal to "{compareValue}".'=>'Το «{attribute}» πρέπει να είναι μικρότερο ή ίσο με «{compareValue}».',
'{attribute} must be no greater than {max}.'=>'Το «{attribute}» πρέπει να μην ξεπερνά το {max}.',
'{attribute} must be no less than {min}.'=>'Το «{attribute}» πρέπει να μην είναι λιγότερο από {min}.',
'{attribute} must be repeated exactly.'=>'Το «{attribute}» πρέπει να επαναληφθεί ακριβώς.',
'{attribute} must not be equal to "{compareValue}".'=>'Το «{attribute}» πρέπει να μην είναι ίσο με «{compareValue}».',
'{attribute} should contain at least {min, number} {min, plural, one{character} other{characters}}.'=>'Το «{attribute}» πρέπει να περιέχει το λιγότερο {min, number} {min, plural, one{χαρακτήρα} few{χαρακτήρες} many{χαρακτήρες} other{χαρακτήρες}}.',
'{attribute} should contain at most {max, number} {max, plural, one{character} other{characters}}.'=>'Το «{attribute}» πρέπει να περιέχει το πολύ {max, number} {max, plural, one{χαρακτήρα} few{χαρακτήρες} many{χαρακτήρες} other{χαρακτήρες}}.',
'{attribute} should contain {length, number} {length, plural, one{character} other{characters}}.'=>'Το «{attribute}» πρέπει να περιέχει {length, number} {length, plural, one{χαρακτήρα} few{χαρακτήρες} many{χαρακτήρες} other{χαρακτήρες}}.',
'The file "{file}" is not an image.'=>'O arquivo “{file}” não é uma imagem.',
'The file "{file}" is too big. Its size cannot exceed {limit, number} {limit, plural, one{byte} other{bytes}}.'=>'O arquivo “{file}” é grande demais. Seu tamanho não pode exceder {limit, number} {limit, plural, one{byte} other{bytes}}.',
'The file "{file}" is too small. Its size cannot be smaller than {limit, number} {limit, plural, one{byte} other{bytes}}.'=>'O arquivo “{file}” é pequeno demais. Seu tamanho não pode ser menor do que {limit, number} {limit, plural, one{byte} other{bytes}}.',
'The file "{file}" is too small. Its size cannot be smaller than {limit, number} {limit, plural, one{byte} other{bytes}}.'=>'O arquivo “{file}” é pequeno demais. Seu tamanho não pode ser menor que {limit, number} {limit, plural, one{byte} other{bytes}}.',
'The format of {attribute} is invalid.'=>'O formato de “{attribute}” é inválido.',
'The image "{file}" is too large. The height cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.'=>'O arquivo “{file}” é grande demais. A altura não pode ser maior do que {limit, number} {limit, plural, one{pixel} other{pixels}}.',
'The image "{file}" is too large. The width cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.'=>'O arquivo “{file}” é grande demais. A largura não pode ser maior do que {limit, number} {limit, plural, one{pixel} other{pixels}}.',
'The image "{file}" is too small. The height cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.'=>'O arquivo “{file}” é pequeno demais. A altura não pode ser menor do que {limit, number} {limit, plural, one{pixel} other{pixels}}.',
'The image "{file}" is too small. The width cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.'=>'O arquivo “{file}” é pequeno demais. A largura não pode ser menor do que {limit, number} {limit, plural, one{pixel} other{pixels}}.',
'The image "{file}" is too large. The height cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.'=>'O arquivo “{file}” é grande demais. A altura não pode ser maior que {limit, number} {limit, plural, one{pixel} other{pixels}}.',
'The image "{file}" is too large. The width cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.'=>'O arquivo “{file}” é grande demais. A largura não pode ser maior que {limit, number} {limit, plural, one{pixel} other{pixels}}.',
'The image "{file}" is too small. The height cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.'=>'O arquivo “{file}” é pequeno demais. A altura não pode ser menor que {limit, number} {limit, plural, one{pixel} other{pixels}}.',
'The image "{file}" is too small. The width cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.'=>'O arquivo “{file}” é pequeno demais. A largura não pode ser menor que {limit, number} {limit, plural, one{pixel} other{pixels}}.',
'The verification code is incorrect.'=>'O código de verificação está incorreto.',
'You are not allowed to perform this action.'=>'Você não está autorizado a realizar essa ação.',
'You can upload at most {limit, number} {limit, plural, one{file} other{files}}.'=>'Você pode fazer o upload de no máximo {limit, number} {limit, plural, one{arquivo} other{arquivos}}.',
'You can upload at most {limit, number} {limit, plural, one{file} other{files}}.'=>'Você pode fazer o upload de, no máximo, {limit, number} {limit, plural, one{arquivo} other{arquivos}}.',
'the input value'=>'o valor de entrada',
'{attribute} "{value}" has already been taken.'=>'{attribute} “{value}” já foi utilizado.',
'{attribute} cannot be blank.'=>'“{attribute}” não pode ficar em branco.',
...
...
@@ -64,15 +64,15 @@ return array (
'{attribute} is not a valid email address.'=>'“{attribute}” não é um endereço de e-mail válido.',
'{attribute} must be "{requiredValue}".'=>'“{attribute}” deve ser “{requiredValue}”.',
'{attribute} must be a number.'=>'“{attribute}” deve ser um número.',
'{attribute} must be a string.'=>'“{attribute}” deve ser uma string.',
'{attribute} must be a string.'=>'“{attribute}” deve ser um texto.',
'{attribute} must be an integer.'=>'“{attribute}” deve ser um número inteiro.',
'{attribute} must be either "{true}" or "{false}".'=>'“{attribute}” deve ser “{true}” ou “{false}”.',
'{attribute} must be greater than "{compareValue}".'=>'“{attribute}” deve ser maior do que “{compareValue}”.',
'{attribute} must be greater than "{compareValue}".'=>'“{attribute}” deve ser maior que “{compareValue}”.',
'{attribute} must be greater than or equal to "{compareValue}".'=>'“{attribute}” deve ser maior ou igual a “{compareValue}”.',
'{attribute} must be less than "{compareValue}".'=>'“{attribute}” deve ser menor do que “{compareValue}”.',
'{attribute} must be less than "{compareValue}".'=>'“{attribute}” deve ser menor que “{compareValue}”.',
'{attribute} must be less than or equal to "{compareValue}".'=>'“{attribute}” deve ser menor ou igual a “{compareValue}”.',
'{attribute} must be no greater than {max}.'=>'“{attribute}” não pode ser maior do que {max}.',
'{attribute} must be no less than {min}.'=>'“{attribute}” não pode ser menor do que {min}.',
'{attribute} must be no greater than {max}.'=>'“{attribute}” não pode ser maior que {max}.',
'{attribute} must be no less than {min}.'=>'“{attribute}” não pode ser menor que {min}.',
'{attribute} must be repeated exactly.'=>'“{attribute}” deve ser repetido exatamente.',
'{attribute} must not be equal to "{compareValue}".'=>'“{attribute}” não deve ser igual a “{compareValue}”.',
'{attribute} should contain at least {min, number} {min, plural, one{character} other{characters}}.'=>'“{attribute}” deve conter pelo menos {min, number} {min, plural, one{caractere} other{caracteres}}.',