/** * @param Route $route * @param CmfDbObject $object * @param array $conditions */ protected function addParentIdsConditionsForDbObjectInjection(Route $route, CmfDbObject $object, array &$conditions) { foreach ($route->parameterNames() as $name) { if ($object->_hasField($name)) { $conditions[$name] = $route->parameter($name); } } }
/** * Get owner ID field name. Autodetects 'user_id' and 'admin_id'. In other cases - owerwrite this method * @param CmfDbObject $object * @return string * @throws \Exception */ protected function getOwnerIdFieldName(CmfDbObject $object) { if ($object->_hasField('user_id')) { return 'user_id'; } else { if ($object->_hasField('admin_id')) { return 'admin_id'; } else { throw new \Exception('InjectsDbObjectsAndValidatesOwner::getOwnerIdFieldName() cannot find owner id field name'); } } }