Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add doc composer install and english readme #56

Merged
merged 6 commits into from
Nov 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
141 changes: 141 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
![KumbiaPHP](http://proto.kumbiaphp.com/img/kumbiaphp.png)

[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/KumbiaPHP/ActiveRecord/badges/quality-score.png?s=f7230602070a9e9605d46544197bcdac46166612)](https://scrutinizer-ci.com/g/KumbiaPHP/ActiveRecord/)
[![Code Coverage](https://scrutinizer-ci.com/g/KumbiaPHP/ActiveRecord/badges/coverage.png?s=58997633701e84050c0ebd5334f3eb1bb8b7ad42)](https://scrutinizer-ci.com/g/KumbiaPHP/ActiveRecord/)
[![Build Status](https://travis-ci.org/KumbiaPHP/ActiveRecord.png?branch=master)](https://travis-ci.org/KumbiaPHP/ActiveRecord)
[![Code Climate](https://codeclimate.com/github/KumbiaPHP/ActiveRecord/badges/gpa.svg)](https://codeclimate.com/github/KumbiaPHP/ActiveRecord)

ENGLISH - [SPANISH](/README.md)

# ActiveRecord

New ActiveRecord in development, requires PHP > 5.3

Don't use in production

## Install with composer in KumbiaPHP

Requires KumbiaPHP > 0.9RC

* Create file ***composer.json*** in to project root:

```yml
--project
|
|--vendor
|--default
|--core
|--composer.json This is our file
```

* Add the next lines:

```json
{
"require": {
"kumbia/activerecord" : "dev-master"
}
}
```

* Execute command **composer install**

* Continue with steps number 2 and 3 of the next section.

## Install in KumbiaPHP

Requires KumbiaPHP > 0.9RC

1. Copy folder ***lib/Kumbia*** in vendor. (vendor/Kumbia/ActiveRecord/..)

2. Copy [config_databases.php](/config_databases.php) in ***app/config/databases.php*** and set configuration

3. Add in ***app/libs/*** : [lite_record.php](#literecord) and/or [act_record.php](#actrecord)


### LiteRecord

For those who prefer SQL and the advantages of an ORM it includes a mini ActiveRecord

```php
<?php
//app/libs/lite_record.php

/**
* LiteRecord
* For those who prefer SQL and the advantages of an ORM
*
* Parent class to add your methods
*
* @category Kumbia
* @package ActiveRecord
* @subpackage LiteRecord
*/

use Kumbia\ActiveRecord\LiteRecord as ORM;

class LiteRecord extends ORM
{

}
```

### ActRecord

Full ActiveRecord

```php
<?php
//app/libs/act_record.php

/**
* ActiveRecord
*
* Parent class to add your methods
*
* @category Kumbia
* @package ActiveRecord
* @subpackage ActiveRecord
*/

use Kumbia\ActiveRecord\ActiveRecord;

class ActRecord extends ActiveRecord
{

}
```

# Example

## Model

```php
<?php
//app/models/people.php

class People extends ActRecord //or LiteRecord depending on your choice
{

}
```

## Controller

```php
<?php
//app/controller/people_controller.php

//Load::models('people'); This is not necessary in v1

class PeopleController extends AppController {

public function index() {
$this->data = People::all();
}

public function find($id) {
$this->data = People($id);
}
}
```
39 changes: 34 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,52 @@
[![Build Status](https://travis-ci.org/KumbiaPHP/ActiveRecord.png?branch=master)](https://travis-ci.org/KumbiaPHP/ActiveRecord)
[![Code Climate](https://codeclimate.com/github/KumbiaPHP/ActiveRecord/badges/gpa.svg)](https://codeclimate.com/github/KumbiaPHP/ActiveRecord)

ESPAÑOL - [ENGLISH](/README.en.md) - [DEV](/README-DEV.md)
ESPAÑOL - [ENGLISH](/README.en.md)

# ActiveRecord

Nuevo ActiveRecord en desarrollo, requiere PHP 5.3

No usar en producción

## Instalar con composer en KumbiaPHP

Necesita KumbiaPHP > 0.9RC

* Crear el archivo ***composer.json*** en la raiz del proyecto:

```yml
--proyecto
|
|--vendor
|--default
|--core
|--composer.json Acá va nuestro archivo
```

* Añadir el siguiente código:

```json
{
"require": {
"kumbia/activerecord" : "dev-master"
}
}
```

* Ejecutar el comando **composer install**

* Seguir los pasos 2 y 3 de la siguiente sección.

## Instalar en KumbiaPHP

Necesita KumbiaPHP > 0.9RC

1. Copiar [config_databases.php](/config_databases.php) en app/config/databases.php y configurar
1. Copiar la carpeta lib/Kumbia en vendor. (vendor/Kumbia/ActiveRecord/..)

2. Copiar la carpeta lib/Kumbia en vendor. (vendor/Kumbia/ActiveRecord/..)
3. Añadir en app/libs/ : [lite_record.php](#LiteRecord) y/o [act_record.php](#ActRecord)
2. Copiar [config_databases.php](/config_databases.php) en app/config/databases.php y configurar

3. Añadir en app/libs/ : [lite_record.php](#literecord) y/o [act_record.php](#actrecord)


### LiteRecord
Expand Down Expand Up @@ -52,7 +82,6 @@ class LiteRecord extends ORM

### ActRecord


ActiveRecord completo

```php
Expand Down