2017 © Pedro Peláez
 

yii-extension eavactiverecord

Implements entity-attribute-value pattern and provides a simple way to work with EAV-attributes.

image

iachilles/eavactiverecord

Implements entity-attribute-value pattern and provides a simple way to work with EAV-attributes.

  • Wednesday, November 19, 2014
  • by iAchilles
  • Repository
  • 1 Watchers
  • 7 Stars
  • 23 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

EavActiveRecord

Implements entity-attribute-value pattern and provides a simple way to work with EAV-attributes. EAV-attributes are stored in the database as separate records but accessed and searched in such a way as if they were columns in the entity's table., (*1)

The following features are supported:, (*2)

  • Eager and lazy loading of EAV-attributes.
  • Dynamic validation rules. The validation rules defined for the EAV-attribute will be added to the model dynamically.
  • Automatically inserting/updating/deleting EAV-attribute values.
  • Accessing and editing EAV-attributes in the same way as if they were real attributes of the model.
  • A simple search by EAV-attributes with using the find methods.

Requirements

  • Yii 1.1.2 or above
  • PHP 5.1 or above

Installation

  1. Download and extract the release files under the folder "protected/components/eavactiverecord".
  2. Run the SQL-script mysql.sql or postgresql.sql (if your DBMS is PostgreSQL) It is located in the following folder: "protected/components/eavactiverecord/schema/". It creates tables needed to work with EAV attributes: eav_set, eav_attribute, eav_attribute_set, eav_attribute_date, eav_attribute_int, eav_attribute_varchar, eav_attribute_text.
  3. Add the following lines in the file "protected/config/main.php":, (*3)

    ```php array( 'import' => array( 'application.components.eavactiverecord.', 'application.components.eavactiverecord.datatypes.', 'application.components.eavactiverecord.helpers.*' ), (*4)


1. It requires cache to be activated in the application: ```php array( … 'components'=>array( … 'cache'=>array( 'class'=>'system.caching.CMemCache', 'servers'=>array( array('host'=>'server1', 'port'=>11211, 'weight'=>60), array('host'=>'server2', 'port'=>11211, 'weight'=>40), ), ), ), );

The extension will use own cache component if it is defined as the following:, (*5)

```php array( … 'components'=>array( … 'eavCache'=>array( 'class'=>'system.caching.CMemCache', 'servers'=>array( array('host'=>'server1', 'port'=>11211, 'weight'=>60), array('host'=>'server2', 'port'=>11211, 'weight'=>40), ), ), ), );, (*6)

   If you do not use cache, add the following code in the file "protected/config/main.php":

   ```php
'components' => array(
        'eavCache' => array(
            'class' => 'system.caching.CDummyCache'
        ),
     )
  1. Extend your model class from the class EavActiveRecord, (*7)

    ```php class Foo extends EavActiveRecord, (*8)


1. Call the method Foo::addColumn(). This method must only be called once for each model that extends EavActiveRecord class. It adds the new column "eav_set_id" in the associated database table. ```php Foo::model()->addColumn();
  1. Since v1.0.2 it includes the GUI module for user interaction (front-end module) based on the extension API. For detailed information about installing the module, reed the EavModule Installation Guide, (*9)

    The screenshot of the module page is shown below EavModule screenshot, (*10)


, (*11)

What's next?

For detailed information on how to use the extension eavactiverecord, please read the following wiki articles:, (*12)

  1. Quick Start Guide
  2. Manage EAV attributes
  3. Manage sets of EAV attributes
  4. Using EAV attributes in the model
    1. Attaching EAV attributes to the model
    2. Assigning a value to the EAV attribute
    3. Accessing the EAV attribute value
    4. Saving the EAV attribute value
    5. Deleting the EAV attribute value
    6. Eager and lazy loading of EAV attribute values
    7. Searching by EAV attributes
    8. Priority of attributes
  5. Creating form elements for EAV attributes using the widget EavForm
  6. The API documentation

The Versions

19/11 2014

dev-master

9999999-dev https://github.com/iAchilles/eavactiverecord

Implements entity-attribute-value pattern and provides a simple way to work with EAV-attributes.

  Sources   Download

MIT

The Requires

  • php >=5.1.0

 

by Igor Manturov, Jr.

extension yii activerecord eav object-attribute-value

19/11 2014

1.0.4

1.0.4.0 https://github.com/iAchilles/eavactiverecord

Implements entity-attribute-value pattern and provides a simple way to work with EAV-attributes.

  Sources   Download

MIT

The Requires

  • php >=5.1.0

 

by Igor Manturov, Jr.

extension yii activerecord eav object-attribute-value

04/11 2014

1.0.3

1.0.3.0 https://github.com/iAchilles/eavactiverecord

Implements entity-attribute-value pattern and provides a simple way to work with EAV-attributes.

  Sources   Download

MIT

The Requires

  • php >=5.1.0

 

by Igor Manturov, Jr.

extension yii activerecord eav object-attribute-value

20/10 2014

1.0.2

1.0.2.0 https://github.com/iAchilles/eavactiverecord

Implements entity-attribute-value pattern and provides a simple way to work with EAV-attributes.

  Sources   Download

MIT

The Requires

  • php >=5.1.0

 

by Igor Manturov, Jr.

extension yii activerecord eav object-attribute-value

08/10 2014

1.0.1

1.0.1.0 https://github.com/iAchilles/eavactiverecord

Implements entity-attribute-value pattern and provides a simple way to work with EAV-attributes.

  Sources   Download

MIT

The Requires

  • php >=5.1.0

 

by Igor Manturov, Jr.

extension yii activerecord eav object-attribute-value

26/09 2014

1.0.0

1.0.0.0 https://github.com/iAchilles/eavactiverecord

Implements entity-attribute-value pattern and provides a simple way to work with EAV-attributes.

  Sources   Download

MIT

The Requires

  • php >=5.1.0

 

by Igor Manturov, Jr.

extension yii activerecord eav object-attribute-value