public static function getLoadSql()
    {
        $tableName = Book2library::getTableName();
        return '
			SELECT
				`' . $tableName . '`.*
			FROM
				`' . Book2library::getDbName() . '`.`' . $tableName . '`
		';
    }
示例#2
0
    public function loadBook2library_Collection()
    {
        // Always create the collection
        $collection = new Book2library_Collection();
        $this->setBook2library_Collection($collection);
        // But only populate it if we have key ID
        if ($this->hasKeyId()) {
            $db = Book2library::getDb();
            $tableName = Book2library::getTableName();
            $sql = '
				SELECT
					`' . $tableName . '`.*
					, ' . implode("\n\t\t\t\t\t, ", CoughObject::getFieldAliases('Library', 'Library_Object', 'library')) . '
				FROM
					`' . Book2library::getDbName() . '`.`' . $tableName . '`
					INNER JOIN `' . Library::getDbName() . '`.`' . Library::getTableName() . '` AS `library`
						ON `' . $tableName . '`.`library_id` = `library`.`library_id`
				WHERE
					`' . $tableName . '`.`book_id` = ' . $db->quote($this->getBookId()) . '
			';
            // Construct and populate the collection
            $collection->loadBySql($sql);
            foreach ($collection as $element) {
                $element->setBook_Object($this);
            }
        }
    }
示例#3
0
    public function loadBook2library_Collection()
    {
        // Always create the collection
        $collection = new Book2library_Collection();
        $this->setBook2library_Collection($collection);
        // But only populate it if we have key ID
        if ($this->hasKeyId()) {
            $db = Book2library::getDb();
            $tableName = Book2library::getTableName();
            $sql = '
				SELECT
					`' . $tableName . '`.*
				FROM
					`' . Book2library::getDbName() . '`.`' . $tableName . '`
				WHERE
					`' . $tableName . '`.`book_id` = ' . $db->quote($this->getBookId()) . '
			';
            // Construct and populate the collection
            $collection->loadBySql($sql);
            foreach ($collection as $element) {
                $element->setBook_Object($this);
            }
        }
    }
    public static function getLoadSql()
    {
        $tableName = Book2library::getTableName();
        return '
			SELECT
				`' . $tableName . '`.*
				, ' . implode("\n\t\t\t\t, ", CoughObject::getFieldAliases('Book', 'Book_Object', 'book')) . '
				, ' . implode("\n\t\t\t\t, ", CoughObject::getFieldAliases('Library', 'Library_Object', 'library')) . '
			FROM
				`' . Book2library::getDbName() . '`.`' . $tableName . '`
				INNER JOIN `' . Book::getDbName() . '`.`' . Book::getTableName() . '` AS `book`
					ON `' . $tableName . '`.`book_id` = `book`.`book_id`
				INNER JOIN `' . Library::getDbName() . '`.`' . Library::getTableName() . '` AS `library`
					ON `' . $tableName . '`.`library_id` = `library`.`library_id`
		';
    }