for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php /** RelationsMicro */
namespace Micro\Mvc\Models;
/**
* Relations class file.
*
* @author Oleg Lunegov <[email protected]>
* @link https://github.com/linpax/microphp-framework
* @copyright Copyright (c) 2013 Oleg Lunegov
* @license https://github.com/linpax/microphp-framework/blob/master/LICENSE
* @package Micro
* @subpackage Mvc\Models
* @version 1.0
* @since 1.0
*/
class Relations implements IRelations
{
/** @var array $data relations setup */
protected $data;
* @inheritdoc
public function add($name, $model, $isMany = false, array $on = [], $where = '', array $params = [], $limit = 0)
$this->data[$name] = [
'IsMany' => $isMany,
'Model' => $model,
'On' => $on,
'Where' => $where,
'Params' => $params,
'Limit' => $limit
];
}
public function get($name)
return !empty($this->data[$name]) ? $this->data[$name] : false;