src/CRUDlex/MySQLData.php
protected function hasChildren($id)
    {
        foreach ($this->definition->getChildren() as $child) {
            $queryBuilder = $this->database->createQueryBuilder();
            $queryBuilder
                ->select('COUNT(id)')
                ->from('`'.$child[0].'`', '`'.$child[0].'`')
                ->where('`'.$child[1].'` = ?')
                ->setParameter(0, $id)
            ;
            $this->addSoftDeletionToQuery($this->getDefinition()->getService()->getData($child[2])->getDefinition(), $queryBuilder);
            $queryResult = $queryBuilder->execute();
            $result      = $queryResult->fetch(\PDO::FETCH_NUM);
            if ($result[0] > 0) {
                return true;
            }
        }
        return false;
    }
protected function hasChildren($id)
    {
        foreach ($this->definition->getChildren() as $child) {
            $queryBuilder = $this->database->createQueryBuilder();
            $queryBuilder
                ->select('COUNT(id)')
                ->from('`'.$child[0].'`', '`'.$child[0].'`')
                ->where('`'.$child[1].'` = ?')
                ->setParameter(0, $id)
            ;
            $this->addSoftDeletionToQuery($this->getDefinition()->getService()->getData($child[2])->getDefinition(), $queryBuilder);
            $queryResult = $queryBuilder->execute();
            $result      = $queryResult->fetch(\PDO::FETCH_NUM);
            if ($result[0] > 0) {
                return true;
            }
        }
        return false;
    }
protected function hasChildren ( $ id ) { foreach ( $ this -> definition -> getChildren ( ) as $ child ) { $ queryBuilder = $ this -> database -> createQueryBuilder ( ) ; $ queryBuilder -> select ( 'COUNT(id)' ) -> from ( '`' . $ child [ 0 ] . '`' , '`' . $ child [ 0 ] . '`' ) -> where ( '`' . $ child [ 1 ] . '` = ?' ) -> setParameter ( 0 , $ id ) ; $ this -> addSoftDeletionToQuery ( $ this -> getDefinition ( ) -> getService ( ) -> getData ( $ child [ 2 ] ) -> getDefinition ( ) , $ queryBuilder ) ; $ queryResult = $ queryBuilder -> execute ( ) ; $ result = $ queryResult -> fetch ( \ PDO :: FETCH_NUM ) ; if ( $ result [ 0 ] > 0 ) { return true ; } } return false ; }
Checks whether the by id given entity still has children referencing it.

@param integer $id
the current entities id

@return boolean
true if the entity still has children
Checks whether the by id given entity still has children referencing it .