@param mixed  $object
@param string $tableName

@throws \Exception

@return string
353593
private function generateReference($object, $tableName)
    {
        $date = new \DateTime();

        $sql = sprintf(
            "SELECT count(id) as counter FROM %s WHERE created_at >= '%s' AND reference IS NOT NULL",
            $tableName,
            $date->format('Y-m-d')
        );

        $this->registry->getConnection()->exec(sprintf('BEGIN WORK'));

        $this->registry->getConnection()->exec(sprintf('LOCK TABLE %s IN EXCLUSIVE MODE', $tableName));

        try {
            $statement = $this->registry->getConnection()->query($sql);
            $row = $statement->fetch();

            $reference = sprintf('%02d%02d%02d%06d',
                $date->format('y'),
                $date->format('n'),
                $date->format('j'),
                $row['counter'] + 1
            );

            $this->registry->getConnection()->update(
                $tableName,
                ['reference' => $reference],
                ['id' => $object->getId()]
            );
            $object->setReference($reference);
        } catch (\Exception $e) {
            $this->registry->getConnection()->exec(sprintf('ROLLBACK WORK'));

            throw $e;
        }

        $this->registry->getConnection()->exec(sprintf('COMMIT WORK'));

        return $reference;
    }
89745
public function update($object, $meta=null)
    {
        $query = new Query\Update();
        if (!is_object($object)) {
            throw new \BadMethodCallException("Please use updateTable()");
        } 

        if ($meta) {
            $meta = !$meta instanceof Meta ? $this->mapper->getMeta($meta) : $meta;
        } else {
            $meta = $this->mapper->getMeta(get_class($object));
        }

        if (!$meta->primary) {
            throw new Exception("Cannot update: meta {$meta->id} has no primary key");
        }
        if (!$meta->canUpdate) {
            throw new Exception("Meta {$meta->id} prohibits update");
        }

        event_before: {
            if (isset($meta->on['beforeUpdate'])) {
                foreach ($meta->on['beforeUpdate'] as $cb) { $cb = [$object, $cb]; $cb(); }
            }
            if (isset($this->on['beforeUpdate'])) {
                foreach ($this->on['beforeUpdate'] as $cb) { $cb($object, $meta); }
            }
        }

        query: {
            $query->set = $this->mapper->mapObjectToRow($object, $meta, 'update');
            $query->where = $meta->getIndexValue($object);

            list ($sql, $params, $props) = $query->buildQuery($meta);
            // don't need to do formatParams - it's already covered by the mapPropertiesToRow call in
            // table update mode

            $return = $this->getConnector()->exec($sql, $params);
        }

        event_after: {
            if (isset($meta->on['afterUpdate'])) {
                foreach ($meta->on['afterUpdate'] as $cb) { $cb = [$object, $cb]; $cb(); }
            }
            if (isset($this->on['afterUpdate'])) {
                foreach ($this->on['afterUpdate'] as $cb) { $cb($object, $meta); }
            }
        }
        return $return;
    }
443741
public static function getPropertyValue($object,$propertyName)
    {
        $getter = "get" . ucfirst($propertyName);
        if (method_exists($object, $getter)) {
            return $object->$getter();
        }
        return null;
    }
130156
protected function getTablenameCallback($tableName)
    {
        if (isset($GLOBALS['TL_DCA'][$tableName]['config']['tablename_callback'])
            && \is_array($GLOBALS['TL_DCA'][$tableName]['config']['tablename_callback'])
        ) {
            foreach ($GLOBALS['TL_DCA'][$tableName]['config']['tablename_callback'] as $callback) {
                $tableName = Callbacks::call($callback, $tableName, $this) ?: $tableName;
            }
        }

        return $tableName;
    }
802682
public function GetColumnName($objectclass, $propertyname)
	{
		$fm = $this->GetFieldMap($objectclass, $propertyname);
		return $fm->ColumnName;
	}
204198
protected function isPropertyGettable($object, $propertyName)
    {
        $flag = false;

        if (ObjectAccess::isPropertyGettable($object, $propertyName)) {
            $flag = true;
            $getterMethodName = 'get' . ucfirst($propertyName);

            if (false === method_exists($object, $getterMethodName)
                && is_callable([$object, $getterMethodName])
            ) {
                try {
                    $object->$getterMethodName();
                } catch (\Exception $e) {
                    if ($e instanceof MethodNotFoundException
                        || false === $e instanceof SilentExceptionInterface
                    ) {
                        $flag = false;
                    }
                }
            }
        }

        return $flag;
    }
1215964
public function objectName($objectName = null)
    {
        if ($objectName === null)
        {
            return $this->_objectName;
        }
        $this->_objectName = $objectName;

        return $this;
    }
300586
private function getObjectClassname($object)
    {
        if (!is_object($object)) {
            return null;
        }

        if (!$this->isClassMappingEnabled()) {
            return '';
        }

        if(is_callable($this->getClassmappingCallback())) {
            $className = call_user_func_array($this->getClassmappingCallback(), [$object]);
        } else {
            $className = get_class($object);
        }

        return $className == 'stdClass' ? '' : $className;
    }
699491
public function getDataForRow($key, $object)
    {
        $translationManager = $this->framework->getInstance('\\Zepi\\Core\\Language\\Manager\\TranslationManager');
        
        switch ($key) {
            case 'name':
                return '<span class="mdi mdi-group"></span>' . $object->getName();
            break;
            
            case 'uuid':
                return $object->getUuid();
            break;
            
            case 'actions':
                $request = $this->framework->getRequest();
                return '<a href="' . $request->getFullRoute('administration/groups/modify/' . $object->getUuid()) . '" class="btn btn-primary"><span class="glyphicon glyphicon-pencil"></span>'
                     .     $translationManager->translate('Modify', '\\Zepi\\Web\\AccessControl')
                     . '</a>'
                     . '<a href="' . $request->getFullRoute('administration/groups/delete/' . $object->getUuid()) . '" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span>'
                     .     $translationManager->translate('Delete', '\\Zepi\\Web\\AccessControl')
                     . '</a>';
            break;
                
            default:
                return '-';
            break;
        }
    }
369339
public static function query($object = null)
    {
        if($object)
        {
            $class = BeanFactory::getObjectClass($object);
        }
        else
        {
            $class = static::__getRealClassName();
        }
        return Db::query(ModelManager::getDbPoolName($class), $class)->table(ModelManager::getTable($class));
    }
740582
public function getTableCreateSql($tableName)
    {
        $tables = DbHelper::getTablesCreateSql();

        if (!isset($tables[$tableName])) {
            throw new Exception("The table '$tableName' SQL creation code couldn't be found.");
        }

        return $tables[$tableName];
    }
285584
private function findTableByName($tableName)
    {
        $tables = $this->getSchemaManager()->listTables();
        foreach ($tables as $table) {
            if ($table->getName() === $tableName) {
                return $table;
            }
        }

        throw new \InvalidArgumentException(\sprintf('Table with name "%s" does not exists.', $tableName));
    }
1146728
public static function get(array $object, $keys)
    {
        $parts = explode('.', $keys);
        $key = array_shift($parts);

        if (isset($object[$key])) {
            if (!empty($parts) && is_array($object[$key])) {
                return static::get($object[$key], implode('.', $parts));
            }

            return $object[$key];
        }

        if (array_key_exists($key, $object)) {
            return null;
        }
        throw new \Exception("Key `{$keys}` doesn't exist for array keys [".implode(',', array_keys($object)).']');
    }
121538
public function handle(string $tableName)
    {
        $recordFinder = GeneralUtility::makeInstance(RecordFinder::class);
        $pidOfMainTable = $recordFinder->findPidOfMainTableRecord($tableName);
        $recordData = GeneralUtility::makeInstance(RecordData::class);

        $childRelationUids = [];
        $numberOfChildRelationsToCreate = 2;
        $numberOfChildRows = 4;
        $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
        for ($i = 0; $i < $numberOfChildRows; $i ++) {
            $fieldValues = [
                'pid' => $pidOfMainTable,
            ];
            $connection = $connectionPool->getConnectionForTable('tx_styleguide_inline_mn_child');
            $connection->insert('tx_styleguide_inline_mn_child', $fieldValues);
            $fieldValues['uid'] = $connection->lastInsertId('tx_styleguide_inline_mn_child');
            if (count($childRelationUids) < $numberOfChildRelationsToCreate) {
                $childRelationUids[] = $fieldValues['uid'];
            }
            $fieldValues = $recordData->generate('tx_styleguide_inline_mn_child', $fieldValues);
            $connection->update(
                'tx_styleguide_inline_mn_child',
                $fieldValues,
                [ 'uid' => (int)$fieldValues['uid'] ]
            );
        }

        $fieldValues = [
            'pid' => $pidOfMainTable,
            'inline_1' => $numberOfChildRelationsToCreate,
        ];
        $connection = $connectionPool->getConnectionForTable($tableName);
        $connection->insert($tableName, $fieldValues);
        $parentid = $fieldValues['uid'] = $connection->lastInsertId($tableName);
        $fieldValues = $recordData->generate($tableName, $fieldValues);
        $connection->update(
            $tableName,
            $fieldValues,
            [ 'uid' => (int)$fieldValues['uid'] ]
        );

        $this->generateTranslatedRecords($tableName, $fieldValues);

        foreach ($childRelationUids as $uid) {
            $mmFieldValues = [
                'pid' => $pidOfMainTable,
                'parentid' => $parentid,
                'childid' => $uid,
            ];
            $connection = $connectionPool->getConnectionForTable('tx_styleguide_inline_mn_mm');
            $connection->insert('tx_styleguide_inline_mn_mm', $mmFieldValues);
        }
    }
1319307
public function extract($object)
    {
        if (!$object instanceof PageInfo) {
            throw new \Exception('$object must be an instance of PageInfo');
        }
        /* @var $object PageInfo */
        $data = parent::extract($object);

        return $data;
    }
878609
public function count($object) {
        $tableName = $this->mapping->getTableName($object);

        return $this->getDriver()->count($tableName);
    }
350949
public function extract($object)
    {
        if (!$object instanceof PageEntityInterface) {
            throw new Exception\InvalidArgumentException(
                '$object must be an instance of PlaygroundCms\Entity\PageInterface'
            );
        }

        /* @var $object PageInterface*/
        $data = parent::extract($object);
        $data = $this->mapField('id', 'page_id', $data);

        return $data;
    }