Fixess nette 3.0 version

This commit is contained in:
2022-01-25 18:30:23 +01:00
parent 431961ed8f
commit c69bf82ecc
7 changed files with 126 additions and 14 deletions

View File

@@ -4,5 +4,5 @@ namespace App\Model\Database\Entity;
abstract class AbstractEntity abstract class AbstractEntity
{ {
use \Nette\SmartObject;
} }

View File

@@ -10,6 +10,8 @@ trait TId
* @ORM\Column(type="integer", nullable=FALSE) * @ORM\Column(type="integer", nullable=FALSE)
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue * @ORM\GeneratedValue
*
* @property int $id
*/ */
private $id; private $id;

View File

@@ -10,6 +10,10 @@ use Doctrine\Common\Collections\Collection;
/** /**
* @ORM\Entity(repositoryClass="App\Model\Database\Repository\DictTypeRepository") * @ORM\Entity(repositoryClass="App\Model\Database\Repository\DictTypeRepository")
* @ORM\HasLifecycleCallbacks * @ORM\HasLifecycleCallbacks
*
* @property int $id
* @property String $shortName
* @property String $fullName
*/ */
class DictType extends AbstractEntity class DictType extends AbstractEntity
{ {

View File

@@ -8,6 +8,8 @@ use App\Model\Database\Entity\Attributes\TId;
/** /**
* @ORM\Entity(repositoryClass="App\Model\Database\Repository\SuffixRepository") * @ORM\Entity(repositoryClass="App\Model\Database\Repository\SuffixRepository")
* @ORM\HasLifecycleCallbacks * @ORM\HasLifecycleCallbacks
*
* @property String $text
*/ */
class Suffix extends AbstractEntity class Suffix extends AbstractEntity
{ {

View File

@@ -9,6 +9,16 @@ use App\Model\Database\Entity\Attributes\TId;
* @ORM\Entity(repositoryClass="App\Model\Database\Repository\TermRepository") * @ORM\Entity(repositoryClass="App\Model\Database\Repository\TermRepository")
* @ORM\HasLifecycleCallbacks * @ORM\HasLifecycleCallbacks
* @ORM\Table(indexes={@ORM\Index(columns={"string1"}, flags={"fulltext"}),@ORM\Index(columns={"string2"}, flags={"fulltext"})}) * @ORM\Table(indexes={@ORM\Index(columns={"string1"}, flags={"fulltext"}),@ORM\Index(columns={"string2"}, flags={"fulltext"})})
*
* @property int $id
* @property String $string1
* @property String $string2
* @property Dictionary $dictionary
* @property Suffix $suffix1
* @property Suffix $suffix2
* @property DictType $type
* @property int $order2
* @property String $member
*/ */
class Term extends AbstractEntity class Term extends AbstractEntity
{ {
@@ -59,12 +69,6 @@ class Term extends AbstractEntity
*/ */
protected $pronunciations; protected $pronunciations;
public function setType(DictType $type)
{
$this->type = $type;
return $this;
}
/** /**
* @ORM\Column(type="string",nullable=true) * @ORM\Column(type="string",nullable=true)
*/ */
@@ -115,6 +119,106 @@ class Term extends AbstractEntity
/**
* Get the value of string1
*/
public function getString1()
{
return $this->string1;
}
/**
* Set the value of string1
*
* @return self
*/
public function setString1($string1)
{
$this->string1 = $string1;
return $this;
}
/**
* Get the value of string2
*/
public function getString2()
{
return $this->string2;
}
/**
* Set the value of string2
*
* @return self
*/
public function setString2($string2)
{
$this->string2 = $string2;
return $this;
}
/**
* Get the value of suffix1
*/
public function getSuffix1()
{
return $this->suffix1;
}
/**
* Set the value of suffix1
*
* @return self
*/
public function setSuffix1($suffix1)
{
$this->suffix1 = $suffix1;
return $this;
}
/**
* Get the value of suffix2
*/
public function getSuffix2()
{
return $this->suffix2;
}
/**
* Set the value of suffix2
*
* @return self
*/
public function setSuffix2($suffix2)
{
$this->suffix2 = $suffix2;
return $this;
}
/**
* Get the value of type
*/
public function getType()
{
return $this->type;
}
/**
* Set the value of type
*
* @return self
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
} }
?> ?>

View File

@@ -90,7 +90,7 @@ final class HomePresenter extends BaseFrontPresenter
$result = $this->em->getTermRepository()->fetch($query)->setFetchJoinCollection(FALSE); $result = $this->em->getTermRepository()->fetch($query)->setFetchJoinCollection(FALSE);
if ($paginate) { if ($paginate) {
$this["paginator"]->setItemCount($result->getTotalCount()); $this["paginator"]->setItemCount(count($result));
$result->applyPaginator($this['paginator']); $result->applyPaginator($this['paginator']);
$offset = $this['paginator']->getOffset(); $offset = $this['paginator']->getOffset();
$itemsPerPage = $this['paginator']->getItemsPerPage(); $itemsPerPage = $this['paginator']->getItemsPerPage();

View File

@@ -44,16 +44,15 @@ $( document ).ready(function() {
</tr> </tr>
</table> </table>
{ifset $result} {ifset $result}
{dump $result}
<table class="e-table" n:snippet="termsComnainer"> <table class="e-table" n:snippet="termsComnainer">
<tr> <tr>
<th>Vyraz</th><th>Preklad</th><th>Typ</th><th>Member</th> <th>Vyraz</th><th>Preklad</th><th>Typ</th><th>Member</th>
</tr> </tr>
{foreach $result as $term} {foreach $result as $term}
{dump $term}
<tr> <tr data-url="{link getInfo! $term->id}" n:snippet="term-$term->id">
{if $translation->getDirection() == 1} {if $translation->getDirection() == 1}
<td>{$term->string1}{if $term->suffix1}&nbsp;{$term->suffix1->text}{/if}</td> <td>{$term->string1}{if $term->suffix1}&nbsp;{$term->suffix1->text}{/if}</td>
<td>{$term->string2}{if $term->suffix2}&nbsp;{$term->suffix2->text}{/if}</td> <td>{$term->string2}{if $term->suffix2}&nbsp;{$term->suffix2->text}{/if}</td>
@@ -73,3 +72,4 @@ $( document ).ready(function() {
</div> </div>
{/block} {/block}