How to implement HasMany() relationship with PHP?
I have the feeling that there is something wrong with your database structure. According your query, user will have exactly one item?

If one user can have many items and the items belongs only to this user, your schema should look like:

User:
ID Name ...

Item
ID Name UserId ...


So your query will look like

SELECT * FROM Item where UserId=100


If the items are shared you need a additional table

UserItemRelation
UserID ItemID

SELECT i.* FROM Item as i, UserItemRelation as r WHERE i.ID=r.ItemID and r.UserID=100


In both cases there is no need to join the User table as you know already the user ID.



Do get this into an abstract method in your model class you have to extract every information related to your concrete class into abstracts methods. Just as a draft:

function __call($method_name, $args) 
{
     if (isRelationGetter($method_name))   
     {
         return getRelatedEntities(extractField($method_name))
     }
     ....
}


function isRelationGetter ($method_name)
{
    $field=extractField($method_name);
    return isRelationField($field)
}

abstract function isRelationField($field);
abstract function getFieldInfo($field);
abstract function getPrimaryKey();

function getRelatedEntities($field)
{
    $fieldInfo=getFieldInfo($field)
    $query="SELECT * FROM "+$fieldInfo['foreignTable]+" where $fieldInfo['foreignKeyField]="+getPrimaryKey();
    //any database abstraction here
    return fetchAll($query)
}




As you see, a lot of magic.

If you write your own ORM let me recommend to automatically generate some abstract classes between your entity classes and your model and add all the getter to this abstract class. The getter itself can then call getRelatedEntities and you get rid of all this name guessing. Of course it would be easier to use an existing ORM.