Item In Social Engine(SE)

Item an important feather in SE. We can make our life easy by using it.

For decliring Item in SE. We have to do it in Module/setting/manifest.php
Here we use this

// Items ---------------------------------------------------------------------
    'items' => array(

Every item will represent a particular table.
If we follow the naming convention of SE in database table.
Then our Table name will be plural and row class will be singular

So, If we have a item named “item” then it’s primary key will be “item_id” and table will be “items”

Calling Item

By using item we can easily use any table and get it’s a particular row easily.

Table info using Item

$tableInfo = Engine_Api::_()->getItemTable('[itemname]');

Table’s a perticular row using Item

$rowInfo = Engine_Api::_()->getItem('[itemname]',[primary_key_value]);

We have also two very important items.

1. Viewer
2. Subject

##Viewer: This item gives us the information of a user who is current viewing on the site

$viewer = Engine_Api::_()->user()->getViewer();
$id = $viewer->getIdentity(); 

[This function will return id of this table, it is a magic function of item in SE]

##Subject: This item gives us the information of a subject which is being viewing by a user

$subject = Engine_Api::_()->core()->getSubject();
$id = $subject->getIdentity(); 

[This function will return id of this table, it is a magic function of item in SE]

Before we using subject we first have to set he subject
Setting a subject


How to set

if (0 !== ($id = (int) $this->_getParam('id')) &&
                null !== ($subjectToSet = Engine_Api::_()->getItem('item', $id)))

We have to set it in it’s controller. and it is good if we set it in ini()

public function init()

Tagged: , , ,

One thought on “Item In Social Engine(SE)

  1. Gitesh Dang August 10, 2012 at 5:05 pm Reply

    Hi Mate,
    Well I am getting weird error regarding item.
    I am getting error “Unknown Item Type : advinvite_matchinvite”.
    I have made already model of this class : “Advinvite_Model_Matchinvite” also Api is already there for this module “Advinvite_Api_Core” and I have already set the Item in the manifest file in the array : “advinvite_matchinvite”.

    Still I am getting error and I can’t user getItem feature or relatively coz it always shows unknown item 😦

    Please help me mate….
    Waiting for positive response.
    Thank you 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: