小编Den*_*s V的帖子

如何从Symfony Process运行vi?

我有以下代码:

        $process = new Process('vi');

        try {
            $process->setPty(true);
            $process->mustRun(function ($type, $buffer) {
                echo $buffer;
            });
            //echo $process->getOutput();
        } catch (ProcessFailedException $e) {
            echo $e->getMessage();
        }

但是,它通过以下信息为我而死:

The command "vi" failed.

Exit Code: 1(General error)

Working directory: [path]

Output:
================
Vim: Error reading input, exiting...
Vim: Finished.


Error Output:
================
Vim: Warning: Output is not to a terminal
Vim: Warning: Input is not from a terminal

UPDATE

似乎某些人不清楚我将要做什么.我会解释.此脚本正在控制台中运行.同样的事情通过passthru工作(虽然Vim仍然警告输出).我希望有一个交互式进程,允许用户在发送某个文件之前修改它.我不想实现自己的编辑器,这就是我希望他们使用vi的原因.vi在我的服务器上可用(从我提供的输出中可以清楚地看到).

php symfony symfony-process

7
推荐指数
1
解决办法
686
查看次数

如何在学说中使用 php8 属性而不是注释?

这是我想使用的:

#[ORM\Column(type="string")]
Run Code Online (Sandbox Code Playgroud)

而不是这个:

/**
 *  @ORM\Column(type="string")
 */
Run Code Online (Sandbox Code Playgroud)

但我收到此错误:

(error: Class 'Column' is not annotated with 'Attribute' )
Run Code Online (Sandbox Code Playgroud)

是因为 Doctrine 还不支持它,还是我错过了什么?

php doctrine symfony doctrine-orm php-8

7
推荐指数
2
解决办法
4153
查看次数

Symfony2注销CSRF保护:csrf_provider无法识别

如何保护注销操作?我读了默认配置,然后设置

logout:
    csrf_parameter:       _token
    csrf_provider:        ~
    intention:            logout
Run Code Online (Sandbox Code Playgroud)

但是当我尝试清除缓存时显示以下错误:

[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]"security.firewalls.main.logout"下无法识别的选项"csrf_provider"

我正在使用Symfony 2.4 + FOSUserBundle 1.3.

logout symfony csrf-protection

6
推荐指数
1
解决办法
2354
查看次数

Doctrine2 findBy()按连接表字段排序

我将Symfony2与Doctrine2一起使用.有以下实体:

/**
 * Person
 *
 * @ORM\Entity(repositoryClass="Acme\Bundle\ConsysBundle\Entity\PersonRepository")
 * @ORM\HasLifecycleCallbacks
 * @ORM\Table(name="person")
 */
class Person
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * 
     * @ORM\ManyToOne(targetEntity="Company", inversedBy="persons", fetch="EAGER")
     * @ORM\JoinColumn(name="company_id", referencedColumnName="id", onDelete="SET NULL")
     */
    private $company;

}
Run Code Online (Sandbox Code Playgroud)

/**
 * Company
 *
 * @ORM\Entity(repositoryClass="Acme\Bundle\ConsysBundle\Entity\CompanyRepository")
 * @ORM\HasLifecycleCallbacks
 * @ORM\Table(name="company")
 */
class Company
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     * …
Run Code Online (Sandbox Code Playgroud)

symfony doctrine-orm

5
推荐指数
1
解决办法
2万
查看次数