Generate the code for the given className and primaryKey and write it in a file.
@param string $className The class name.
@param string $primaryKey The primary key.
429379
private function generateCode($className, $primaryKey){
		$tags = $this->config->getTags();
		
		$class    = new ClassGenerator();
		$docblock = DocBlockGenerator::fromArray(array(
			'shortDescription' => ucfirst($className) .' model class',
			'longDescription'  => 'This is a model class generated with DavidePastore\ParisModelGenerator.',
			'tags'             => $tags
		));
		
		$idColumn = new PropertyGenerator('_id_column');
		
		$idColumn
			->setStatic(true)
			->setDefaultValue($primaryKey);
		
		$table = new PropertyGenerator('_table');
		
		$table
			->setStatic(true)
			->setDefaultValue($className);
			
		$tableUseShortName = new PropertyGenerator('_table_use_short_name');
		
		$tableUseShortName
			->setStatic(true)
			->setDefaultValue(true);
		
		$namespace = $this->config->getNamespace();
		$extendedClass = '\Model';
		if(isset($namespace) && !empty($namespace)){
			$class->setNamespaceName($this->config->getNamespace());
		}
		
		$class
			->setName(ucfirst($className))
			->setDocblock($docblock)
			->setExtendedClass($extendedClass)
			->addProperties(array(
				$idColumn,
				$table,
				$tableUseShortName
			));
		
		
			
		$file = FileGenerator::fromArray(array(
			'classes'  => array($class),
			'docblock' => DocBlockGenerator::fromArray(array(
				'shortDescription' => ucfirst($className) . ' class file',
				'longDescription'   => null,
				'tags'             => $tags
			))
		));
		
		$generatedCode = $file->generate();
		
		$directory = $this->config->getDestinationFolder() . $namespace;
		
		if(!file_exists($directory)){
			mkdir($directory, 0777, true);
		}
		
		$filePath = $directory . "/" . $class->getName() . ".php";
		
		if(file_exists($filePath) && !$this->force){
			$helper = $this->getHelper('question');
			$realPath = realpath($filePath);
			$this->output->writeln("\n");
			$question = new ConfirmationQuestion('Do you want to overwrite the file "' . $realPath . '"?', false);

			if ($helper->ask($this->input, $this->output, $question)) {
				$this->writeInFile($filePath, $generatedCode);
			}
		}
		else {
			$this->writeInFile($filePath, $generatedCode);
		}
	}
547618
protected function addSetPrimaryKey_SinglePK(&$script)
    {

        $pkeys = $this->getTable()->getPrimaryKey();
        $col = $pkeys[0];
        $clo = strtolower($col->getName());
        $ctype = $col->getPhpType();

        $script .= "
    /**
     * Generic method to set the primary key ($clo column).
     *
     * @param  $ctype \$key Primary key.
     * @return void
     */
    public function setPrimaryKey(\$key)
    {
        \$this->set" . $col->getPhpName() . "(\$key);
    }
";
    }
1245839
protected function key($data = null)
    {
        if (is_null($data)) {
            $data = $this->getPK();
            //
            if (Table::count($data) > 1) {
                throw new ManyPrimaryKeysException();
            } elseif (Table::count($data) == 0) {
                throw new PrimaryKeyNotFoundException(static::$table);
            }
            //
            $this->_keyName = $data[0]['Column_name'];
            $this->_key['name'] = $data[0]['Column_name'];
        } else {
            $this->_keyName = $data['key'];
            $this->_key['name'] = $data['key'];
        }
    }
173010
public function primaryKey(string $columnName)
    {
        $this->primaryKey = $this->buildPrimaryKeyColumn($columnName);
        $this->columns    = [$columnName => $this->primaryKey] + $this->columns;
    }
1277173
public function update(array $data, $primaryKey)
    {
        $this->normalizeDataColumns($data);

        $this->setSearchIndexableData($data);

        return $this->app['db']->update($this->getTable(), $data, [ $this->getPrimaryKey() => $primaryKey]);
    }
498982
public function prepareArrayBeforeToXmlConvert(array $data, $primaryKey = '')
    {
        $result = [];
        $iterator = new RecursiveArrayIterator($data);
        $this->arrayWalk($iterator, $result, '');

        return '' !== (string) $primaryKey ? [$primaryKey => $result] : $result;
    }
160459
public function prepareSchemaAppend(bool $primaryKey, bool $autoIncrement): ?string
    {
        switch ($this->schema) {
            case TableStructure::SCHEMA_MSSQL:
                $append = $primaryKey ? 'IDENTITY PRIMARY KEY' : '';
                break;

            case TableStructure::SCHEMA_OCI:
            case TableStructure::SCHEMA_PGSQL:
                $append = $primaryKey ? 'PRIMARY KEY' : '';
                break;

            case TableStructure::SCHEMA_SQLITE:
                $append = trim(($primaryKey ? 'PRIMARY KEY ' : '') . ($autoIncrement ? 'AUTOINCREMENT' : ''));
                break;

            case TableStructure::SCHEMA_CUBRID:
            case TableStructure::SCHEMA_MYSQL:
            default:
                $append = trim(($autoIncrement ? 'AUTO_INCREMENT ' : '') . ($primaryKey ? 'PRIMARY KEY' : ''));
        }

        return empty($append) ? null : $append;
    }
872013
public function firePrimaryKeyCallbacks(int $primaryKey)
    {
        $this->columnData[$this->primaryKey] = $primaryKey;

        foreach ($this->onInsertCallbacks as $callback) {
            $callback($primaryKey);
        }
    }
149374
public function getAttributeByKey($key, array $classData)
    {
        if (false === array_key_exists($key, $classData)) {
            return '';
        }

        return (string) $classData[$key];
    }
265204
private function _fetch_primary_key()
    {
        if($this->primary_key == NULl)
        {
            $this->primary_key = $this->_database->query("SHOW KEYS FROM `".$this->_table."` WHERE Key_name = 'PRIMARY'")->row()->Column_name;
        }
    }
819088
protected function setPrimaryKey()
    {
        // making default primary key as id
        $primaryKey = isset($this->primaryKey) && is_null($this->primaryKey) ?
            static::$defaultPrimaryKey :
            $this->primaryKey;

        $this->primaryKey = $primaryKey;
    }
1062029
def primary_keys_for(self, cls: ClassDefinition) -> List[SlotDefinitionName]:
        
        return [slot_name for slot_name in self.all_slots_for(cls)
                if self.schema.slots[slot_name].primary_key or self.schema.slots[slot_name].identifier]
34051
public TableWriteItems addPrimaryKeyToDelete(PrimaryKey primaryKey) {
        if (primaryKey != null) {
            if (primaryKeysToDelete == null)
                primaryKeysToDelete = new ArrayList<PrimaryKey>();
            checkConsistency(primaryKey);
            this.primaryKeysToDelete.add(primaryKey);
        }
        return this;
    }
1245431
public function idToPrimaryKey(string $columnName)
    {
        $this->verifyProperty(__METHOD__, IEntity::ID);
        $this->propertyColumnMap[IEntity::ID] = $columnName;
        $this->mappedProperties[IEntity::ID]  = true;
        $this->primaryKey($columnName);
    }
1177156
public function lastInsertId($tableName = null, $primaryKey = null)
    {
        return $this->db->lastInsertId($tableName, $primaryKey);
    }
1354234
private function preparePrimaryKey(array $primaryKey)
	{
		$result = array();
		foreach ($primaryKey as $key => $value) {
			$result[$key] = array(
				$this->getValueType($value) => $value
			);
		}
Debugger::barDump($result);
		return $result;
	}
1296672
public function primaryKey($key = null)
    {
        if ($key !== null) {
            $this->setPrimaryKey($key);
        }

        return $this->getPrimaryKey();
    }