Beispiel #1
0
	Php::Value DI::get(Php::Parameters &params)
	{
		try {
			Php::Value name = params.at(0);
			Php::Value parameters = params.size() > 1 ? params.at(1) : Php::Value(nullptr);
		} catch (const std::out_of_range& e) {
			throw Php::Exception("Invalid number of parameters supplied");
		}

		return this;
	}
Beispiel #2
0
	Php::Value DI::set(Php::Parameters &params)
	{
		try {
			Php::Value name = params.at(0);
			Php::Value definition = params.at(1);
			Php::Value shared = params.size() > 2 ? params.at(2) : Php::Value(false);
		} catch (const std::out_of_range& e) {
			throw Php::Exception("Invalid number of parameters supplied");
		}

		return this;
	}
void CRowPhpBridge::addColumn(Php::Parameters &params)
{
    if(2 == params.size()) {
        if(params.at(0).isString()) {
            m_row.addColumn(
                        params.at(0).stringValue(),
                        CVariantPhpBridge(params.at(1)));
        } else {
            SYNOPSIS_ERR_LOG("Invalid type of parameter[0]:%d\n", params.at(0).type());
        }
    } else {
        SYNOPSIS_ERR_LOG("Invalid number of parameters:%zu\n", params.size());
    }
}
void CRowsPhpBridge::pushBack(Php::Parameters &params)
{
    if(params.size() > 0) {
        if(Php::Type::Object == params.at(0).type()) {
            if(params.at(0).implementation()){
                CRowPhpBridge *pRowPhpBridge = dynamic_cast<CRowPhpBridge*>(params.at(0).implementation());
                if(pRowPhpBridge) {
                    SYNOPSIS_DBG_ERR_LOG("CRowsPhpBridge::pushBack\n");
                    m_Rows.push_back(pRowPhpBridge->daoRow());
                }
            }
        }
    }
}
void CRowPhpBridge::setKeyColumnName(Php::Parameters &params)
{
    if(1 == params.size()) {
        if(params.at(0).isString()) {
            SYNOPSIS_DBG_ERR_LOG("[%s] params.at(0):%s\n",
                                 __PRETTY_FUNCTION__, params.at(0).stringValue().c_str());
            std::string sKeyColumnName = params.at(0).stringValue();
            m_row.SetKeyColumnName(sKeyColumnName);
        } else {
            SYNOPSIS_ERR_LOG("Invalid type of parameter[0]:%d\n", params.at(0).type());
        }
    } else {
        SYNOPSIS_ERR_LOG("Invalid number of parameters:%zu\n", params.size());
    }
}
Php::Value CRowPhpBridge::getColumnValue(Php::Parameters &params)
{
    if(1 == params.size()) {
        if(params.at(0).isString()) {
            SYNOPSIS_DBG_ERR_LOG("CRowPhpBridge::getColumnValue params.at(0):%s\n", params.at(0).stringValue().c_str());
            std::string sKey = params.at(0).stringValue();
            synopsis::CVariant varRes = m_row.getColumnValue(sKey);
            Php::Value phpRes = CVariant2PhpValue(varRes);
            return phpRes;
        } else {
            SYNOPSIS_ERR_LOG("Invalid type of parameter[0]:%d\n", params.at(0).type());
        }
    } else {
        SYNOPSIS_ERR_LOG("Invalid number of parameters:%zu\n", params.size());
    }
    return Php::Value();
}
Beispiel #7
0
	void DI::setDefault(Php::Parameters &params)
	{
		try {
			Php::Value value = params.at(0);
			_default = (DI *) value.implementation();
		} catch (const std::out_of_range& e) {
			throw Php::Exception("Invalid number of parameters supplied");
		}
	}