Simple queue system to delay the processing of tasks.
What you do is that you push in the queue an object and what was done on the object. Then later one, a simple script will go through the queue and will check if something has to be done for the given object.
For example, you have articles with for each articles a list of authors. You want to index the article with also the name of the authors. So it means that you need to update the index when an author is changed and when an article is changed. But you do not want to do the indexing of all the articles of an author when you update the author information (if this take 0.5s per article, with 100 articles, you would have to wait nearly 1 minute!).
So when you update an author you push in the queue: "author x has been updated". Then you have a script that will go in the queue, find that the author has been updated and index each of his articles.
Store the attributes of the model.
To minimize pollution of the property space, all the attributes are stored in this array.
Description of the keys: 'multitenant: Determines possibility of define the model in each tenant separately 'mapped': Determines that the model is a mapped model of another model. A mapped model have not a separate table. 'table': The table in which the model is stored. 'model': The name of the model. 'cols': The definition of the columns. 'idx': The definition of the indexes. 'views': The definition of the views. 'verbose': The verbose name of the model.
getOne( $p = array()) : \Pluf_Model|null
Get one item.
The parameters are the same as the ones of the getList method, but, the return value is either:
$m = Pluf::factory(My_Model::class)->getOne(array('filter' => 'id=1'));
$m = Pluf::factory(My_Model::class)->getOne('id=1');
getList( $p = array()) : \ArrayObject
یک فهرست از موجودیتها را تعیین میکند
The filter should be used only for simple filtering. If you want a complex query, you should create a new view. Both filter and order accept an array or a string in case of multiple parameters: Filter: array('col1=toto', 'col2=titi') will be used in a AND query or simply 'col1=toto' Order: array('col1 ASC', 'col2 DESC') or 'col1 ASC'
This is modelled on the DB_Table pear module interface.
of items or through an exception if database failure
create( $raw = false) : boolean
Create the model into the database.
If raw insert is requested, the preSave/postSave methods are not called and the current id of the object is directly used. This is particularily used when doing backup/restore of data.